datastore

package
v0.0.0-...-f53b987 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockIDFromFilename

func BlockIDFromFilename(filename string) string

Types

type Datastore

type Datastore struct {
	sync.RWMutex
	Path string
	// contains filtered or unexported fields
}

func Open

func Open(ctx context.Context, path string, config store_config.ConfigStore) *Datastore

Open opens a datastore at the supplied path.

func (*Datastore) Blocks

func (ds *Datastore) Blocks() map[string]*block.Block

func (*Datastore) Flush

func (ds *Datastore) Flush(ctx context.Context)

Flush ensures that all pending streams are written to disk. Returns once everything is written. Further writes will block until this is completed.

func (*Datastore) GetBlock

func (ds *Datastore) GetBlock(id, endKey string) (*block.Block, error)

func (*Datastore) JoinBlock

func (ds *Datastore) JoinBlock(ctx context.Context, b *block.Block) (*block.Block, error)

func (*Datastore) NumStreams

func (ds *Datastore) NumStreams() uint32

func (*Datastore) NumValues

func (ds *Datastore) NumValues() uint32

func (*Datastore) Reader

func (ds *Datastore) Reader(ctx context.Context, v *variable.Variable) <-chan *oproto.ValueStream

Reader builds a channel that will return streams for a supplied Variable. If min/maxTimestamp are not nil, streams will only be returned if SOME values inside the stream match. The supplied variable may be a search or a single. The streams returned may be out of order with respect to variable names or timestamps.

func (*Datastore) SplitBlock

func (ds *Datastore) SplitBlock(ctx context.Context, original *block.Block) (*block.Block, *block.Block, error)

SplitBlock splits a single block into multiple (usually 2) smaller blocks. The new blocks' contents are immedately written to disk and reopened by the Datatstore. The old block is removed from disk once the new contents are available. This will block writes to a block for the duration of the reindexing.

func (*Datastore) Writer

func (ds *Datastore) Writer(ctx context.Context) chan<- *oproto.ValueStream

Writer builds a channel that can accept ValueStreams for writing to the datastore. Any ValueStreams written to this channel will eventually be flushed to disk, but they will be immediately available for use. The writes to disk are not guaranteed until Flush is called.

type ReadableStore

type ReadableStore interface {
	// Reader builds a channel that will return streams for a supplied Variable.
	// If min/maxTimestamp are not nil, streams will only be returned if SOME values inside the stream match.
	// The supplied variable may be a search or a single.
	// The streams returned may be out of order with respect to variable names or timestamps.
	Reader(ctx context.Context, v *variable.Variable) <-chan *oproto.ValueStream
}

Jump to

Keyboard shortcuts

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