indexes

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: MIT Imports: 6 Imported by: 12

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

func (Addr) String

func (a Addr) String() 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(int64) error
	GetSeq() (int64, 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, 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.

Directories

Path Synopsis
mkv
all

Jump to

Keyboard shortcuts

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