package indexes
import "go.cryptoscope.co/margaret/indexes"
Index ¶
- func NewObservable(v interface{}, f func()) luigi.Observable
- type Addr
- type Index
- type SeqSetterIndex
- type Setter
- type SetterIndex
- type SinkIndex
- type StreamProcFunc
- type UnsetValue
Functions ¶
func NewObservable ¶
func NewObservable(v interface{}, f func()) luigi.Observable
NewObservable returns a regular observable that calls f when the last registration is cancelled. This is used to garbage-collect observables from the maps in the indexes.
Types ¶
type Addr ¶
type Addr string
Addr is an address (or key) in the index. TODO maybe not use a string but a Stringer or
func (Addr) String ¶
type Index ¶
type Index interface { // Get returns the an observable of the value stored at the address. // Getting an unset value retuns a valid Observable with a value // of type Unset and a nil error. Get(context.Context, Addr) (luigi.Observable, error) }
Index provides an index table keyed by Addr. Often also implements Setter.
type SeqSetterIndex ¶
type Setter ¶
type Setter interface { // Set sets a value in the index Set(context.Context, Addr, interface{}) error // Delete deletes a value from the index Delete(context.Context, Addr) error }
type SetterIndex ¶
SetterIndex is an index that can be updated using calls to Set and Delete.
type SinkIndex ¶
SinkIndex is an index that is updated by processing a stream.
func NewSinkIndex ¶
func NewSinkIndex(f StreamProcFunc, idx SeqSetterIndex) SinkIndex
type StreamProcFunc ¶
type StreamProcFunc func(context.Context, int64, interface{}, SetterIndex) error
type UnsetValue ¶
type UnsetValue struct { Addr Addr }
UnsetValue is the value of observable returned by idx.Get() when the requested address has not been set yet.
Source Files ¶
index.go obv.go sinkindex.go
Directories ¶
Path | Synopsis |
---|---|
indexes/badger | |
indexes/badger/test | |
indexes/mapidx | |
indexes/mapidx/test | |
indexes/mkv | |
indexes/mkv/test | |
indexes/test | |
indexes/test/all |
- Version
- v0.4.3 (latest)
- Published
- Feb 17, 2022
- Platform
- linux/amd64
- Imports
- 6 packages
- Last checked
- 7 hours ago –
Tools for package owners.