package legacyflumeoffset
import "go.cryptoscope.co/margaret/legacyflumeoffset"
Package legacyflumeoffset implements the first iteration of an offset file. as implemented by https://github.com/flumedb/flumelog-offset Format
data is stored in a append only log, where the byte index of the start of a record is the primary key (offset). offset-><data.length (UInt32BE)> <data ...> <data.length (UInt32BE)> <file_length (UInt32BE or Uint48BE or Uint53BE)> by writing the length of the data both before and after each record it becomes possible to scan forward and backward (like a doubly linked list) It's very handly to be able to scan backwards, as often you want to see the last N items, and so you don't need an index for this.
Index ¶
- type Log
- func Open(path string, codec margaret.Codec) (*Log, error)
- func (l *Log) Append(v interface{}) (int64, error)
- func (l *Log) Changes() luigi.Observable
- func (l *Log) Get(ofst int64) (interface{}, error)
- func (log *Log) Query(specs ...margaret.QuerySpec) (luigi.Source, error)
- func (l *Log) Seq() int64
Types ¶
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
func Open ¶
func (*Log) Append ¶
Append appends a new entry to the log
func (*Log) Changes ¶
func (l *Log) Changes() luigi.Observable
func (*Log) Get ¶
Get returns the entry with sequence number seq
func (*Log) Query ¶
Query returns a stream that is constrained by the passed query specification
func (*Log) Seq ¶
Source Files ¶
impl.go query.go
Directories ¶
Path | Synopsis |
---|---|
legacyflumeoffset/test |
- Version
- v0.4.3 (latest)
- Published
- Feb 17, 2022
- Platform
- linux/amd64
- Imports
- 11 packages
- Last checked
- 11 hours ago –
Tools for package owners.