librarian

package module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 interface{ 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 SeqSetterIndex interface {
	SetterIndex

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

	io.Closer
}

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

type SetterIndex interface {
	Index
	Setter

	Flush() error
}

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

type SinkIndex

type SinkIndex interface {
	luigi.Sink

	QuerySpec() margaret.QuerySpec
}

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, margaret.Seq, 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.

Directories

Path Synopsis
mkv
all

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL