librarian: go.cryptoscope.co/librarian Index | Files | Directories

package librarian

import "go.cryptoscope.co/librarian"

Index

Package Files

encoding.go index.go obv.go sinkindex.go

func NewObservable Uses

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.

type Addr Uses

type Addr string

Addr is an address (or key) in the index. TODO maybe not use a string but a Stringer or interface{ Addr() string }?

type Index Uses

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 Marshaler Uses

type Marshaler interface {
    Marshal() ([]byte, error)
}

type SeqSetterIndex Uses

type SeqSetterIndex interface {
    SetterIndex

    SetSeq(margaret.Seq) error
    GetSeq() (margaret.Seq, error)
}

type Setter Uses

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 Uses

type SetterIndex interface {
    Index
    Setter
}

SetterIndex is an index that can be updated using calls to Set and Delete.

type SinkIndex Uses

type SinkIndex interface {
    luigi.Sink
    Index

    QuerySpec() margaret.QuerySpec
}

SinkIndex is an index that is updated by processing a stream.

func NewSinkIndex Uses

func NewSinkIndex(f StreamProcFunc, idx SeqSetterIndex) SinkIndex

type StreamProcFunc Uses

type StreamProcFunc func(context.Context, margaret.Seq, interface{}, SetterIndex) error

type Unmarshaler Uses

type Unmarshaler interface {
    Unmarshal([]byte) error
}

type UnsetValue Uses

type UnsetValue struct {
    Addr Addr
}

UnsetValue is the value of observable returned by idx.Get() when the requested address has not been set yet.

Directories

PathSynopsis
badger
badger/test
mapidx
mapidx/test
mkv
mkv/test
remote
test
test/all

Package librarian imports 5 packages (graph) and is imported by 41 packages. Updated 2019-10-07. Refresh now. Tools for package owners.