storage

package
v0.0.0-...-ad801e6 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database interface {
	// Options returns database options.
	Options() *Options

	// Open opens the database for reading and writing events.
	Open() error

	// WriteBatch writes a batch of timestamped documents to a namespace.
	WriteBatch(
		ctx context.Context,
		namespace []byte,
		docs []document.Document,
	) error

	// QueryRaw executes a raw query against database for documents matching
	// certain criteria, with optional filtering, sorting, and limiting applied.
	QueryRaw(
		ctx context.Context,
		q query.ParsedRawQuery,
	) (*query.RawResults, error)

	// QueryGrouped executes a grouped query against database for documents matching
	// certain criteria, with optional filtering, grouping, sorting, and limiting applied.
	QueryGrouped(
		ctx context.Context,
		q query.ParsedGroupedQuery,
	) (*query.GroupedResults, error)

	// QueryTimeBucket executes a time bucket query against database for documents
	// matching criteria, and counts the number of matching documents in each time bucket.
	QueryTimeBucket(
		ctx context.Context,
		q query.ParsedTimeBucketQuery,
	) (*query.TimeBucketResults, error)

	// Close closes the database.
	Close() error
}

Database is a database for timestamped events.

func NewDatabase

func NewDatabase(
	namespaces []NamespaceMetadata,
	opts *Options,
) Database

NewDatabase creates a new database.

type NamespaceMetadata

type NamespaceMetadata struct {
	// contains filtered or unexported fields
}

NamespaceMetadata provides namespace-level metadata.

func NewNamespaceMetadata

func NewNamespaceMetadata(id []byte, opts *NamespaceOptions) NamespaceMetadata

NewNamespaceMetadata creates a new namespace metadata.

func (NamespaceMetadata) ID

func (m NamespaceMetadata) ID() []byte

ID returns the namespace ID.

func (NamespaceMetadata) Options

func (m NamespaceMetadata) Options() *NamespaceOptions

Options return the namespace options.

type NamespaceOptions

type NamespaceOptions struct {
	// contains filtered or unexported fields
}

NamespaceOptions provide a set of options controlling namespace-level behavior.

func NewNamespaceOptions

func NewNamespaceOptions() *NamespaceOptions

NewNamespaceOptions create a new set of namespace options.

func (*NamespaceOptions) Retention

func (o *NamespaceOptions) Retention() time.Duration

Retention returns the namespce retention.

func (*NamespaceOptions) SetRetention

func (o *NamespaceOptions) SetRetention(v time.Duration) *NamespaceOptions

SetRetention sets the namespace retention.

type Options

type Options struct {
	// contains filtered or unexported fields
}

Options provide a set of options for the database.

func NewOptions

func NewOptions() *Options

NewOptions create a new set of options.

func (*Options) BoolArrayPool

func (o *Options) BoolArrayPool() *pool.BucketizedBoolArrayPool

BoolArrayPool returns the bool array pool.

func (*Options) BytesArrayPool

func (o *Options) BytesArrayPool() *pool.BucketizedBytesArrayPool

BytesArrayPool returns the string array pool.

func (*Options) ClockOptions

func (o *Options) ClockOptions() clock.Options

ClockOptions returns the clock options.

func (*Options) DoubleArrayPool

func (o *Options) DoubleArrayPool() *pool.BucketizedFloat64ArrayPool

DoubleArrayPool returns the double array pool.

func (*Options) FieldHashFn

func (o *Options) FieldHashFn() hash.StringArrayHashFn

FieldHashFn returns the field hashing function.

func (*Options) FieldPathSeparator

func (o *Options) FieldPathSeparator() byte

FieldPathSeparator returns the path separator when flattening nested document fields. This is used when persisting and querying nested fields.

func (*Options) FieldRetriever

func (o *Options) FieldRetriever() persist.FieldRetriever

FieldRetriever returns the field retriever.

func (*Options) FilePathPrefix

func (o *Options) FilePathPrefix() string

FilePathPrefix return the file path prefix.

func (*Options) FlushQueueSize

func (o *Options) FlushQueueSize() int

FlushQueueSize returns the flush queue size.

func (*Options) InstrumentOptions

func (o *Options) InstrumentOptions() instrument.Options

InstrumentOptions returns the instrument options.

func (*Options) Int64ArrayPool

func (o *Options) Int64ArrayPool() *pool.BucketizedInt64ArrayPool

Int64ArrayPool returns the int64 array pool.

func (*Options) IntArrayPool

func (o *Options) IntArrayPool() *pool.BucketizedIntArrayPool

IntArrayPool returns the int array pool.

func (*Options) NamespaceFieldName

func (o *Options) NamespaceFieldName() string

NamespaceFieldName returns the field name of the namespace field.

func (*Options) PersistManager

func (o *Options) PersistManager() persist.Manager

PersistManager returns the persistence manager.

func (*Options) QueryExecutor

func (o *Options) QueryExecutor() executor.Executor

QueryExecutor returns the query executor.

func (*Options) RawDocSourceFieldPath

func (o *Options) RawDocSourceFieldPath() []string

RawDocSourceFieldPath returns the raw document source field path.

func (*Options) SegmentUnloadAfterUnreadFor

func (o *Options) SegmentUnloadAfterUnreadFor() time.Duration

SegmentUnloadAfterUnreadFor sets the segment unload after unread for duration. If a segment is unread for longer than the configuration duration since its last read access, it is eligible to be unloaded from memory.

func (*Options) SetBoolArrayPool

func (o *Options) SetBoolArrayPool(v *pool.BucketizedBoolArrayPool) *Options

SetBoolArrayPool sets the bool array pool.

func (*Options) SetBytesArrayPool

func (o *Options) SetBytesArrayPool(v *pool.BucketizedBytesArrayPool) *Options

SetBytesArrayPool sets the string array pool.

func (*Options) SetClockOptions

func (o *Options) SetClockOptions(v clock.Options) *Options

SetClockOptions sets the clock options.

func (*Options) SetDoubleArrayPool

func (o *Options) SetDoubleArrayPool(v *pool.BucketizedFloat64ArrayPool) *Options

SetDoubleArrayPool sets the double array pool.

func (*Options) SetFieldHashFn

func (o *Options) SetFieldHashFn(v hash.StringArrayHashFn) *Options

SetFieldHashFn sets the field hashing function.

func (*Options) SetFieldPathSeparator

func (o *Options) SetFieldPathSeparator(v byte) *Options

SetFieldPathSeparator sets the path separator when flattening nested document fields. This is used when persisting and querying nested fields.

func (*Options) SetFieldRetriever

func (o *Options) SetFieldRetriever(v persist.FieldRetriever) *Options

SetFieldRetriever sets the field retriever.

func (*Options) SetFilePathPrefix

func (o *Options) SetFilePathPrefix(v string) *Options

SetFilePathPrefix sets the file path prefix.

func (*Options) SetFlushQueueSize

func (o *Options) SetFlushQueueSize(v int) *Options

SetFlushQueueSize sets the flush queue size.

func (*Options) SetInstrumentOptions

func (o *Options) SetInstrumentOptions(v instrument.Options) *Options

SetInstrumentOptions sets the instrument options.

func (*Options) SetInt64ArrayPool

func (o *Options) SetInt64ArrayPool(v *pool.BucketizedInt64ArrayPool) *Options

SetInt64ArrayPool sets the int64 array pool.

func (*Options) SetIntArrayPool

func (o *Options) SetIntArrayPool(v *pool.BucketizedIntArrayPool) *Options

SetIntArrayPool sets the int array pool.

func (*Options) SetNamespaceFieldName

func (o *Options) SetNamespaceFieldName(v string) *Options

SetNamespaceFieldName sets the field name of the namespace field.

func (*Options) SetPersistManager

func (o *Options) SetPersistManager(v persist.Manager) *Options

SetPersistManager sets the persistence manager.

func (*Options) SetQueryExecutor

func (o *Options) SetQueryExecutor(v executor.Executor) *Options

SetQueryExecutor sets the query executor.

func (*Options) SetRawDocSourceFieldPath

func (o *Options) SetRawDocSourceFieldPath(v []string) *Options

SetRawDocSourceFieldPath sets the raw document source field path.

func (*Options) SetSegmentUnloadAfterUnreadFor

func (o *Options) SetSegmentUnloadAfterUnreadFor(v time.Duration) *Options

SetSegmentUnloadAfterUnreadFor sets the segment unload after unread for duration. If a segment is unread for longer than the configuration duration since its last read access, it is eligible to be unloaded from memory.

func (*Options) SetTickMinInterval

func (o *Options) SetTickMinInterval(v time.Duration) *Options

SetTickMinInterval sets the minimum interval between consecutive ticks for performing periodic administrative tasks (e.g., unloading segments from memory) to smoothen the load.

func (*Options) SetTimestampFieldPath

func (o *Options) SetTimestampFieldPath(v []string) *Options

SetTimestampFieldPath sets the timestamp field path.

func (*Options) SetWriteAsync

func (o *Options) SetWriteAsync(v bool) *Options

SetWriteAsync determines whether a new batch of incoming writes are performed asynchronously. If set to true, writes are acknowledged when they are enqueued to the flush queue. Otherwise, writes are acknowledged when they are flushed to disk.

func (*Options) TickMinInterval

func (o *Options) TickMinInterval() time.Duration

TickMinInterval returns the minimum interval between consecutive ticks for performing periodic administrative tasks (e.g., unloading segments from memory) to smoothen the load.

func (*Options) TimestampFieldPath

func (o *Options) TimestampFieldPath() []string

TimestampFieldPath returns the timestamp field path.

func (*Options) WriteAsync

func (o *Options) WriteAsync() bool

WriteAsync determines whether a new batch of incoming writes are performed asynchronously. If set to true, writes are acknowledged when they are enqueued to the flush queue. Otherwise, writes are acknowledged when they are flushed to disk.

Jump to

Keyboard shortcuts

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