Documentation ¶
Overview ¶
Package kv implements a key-value engine.
Index ¶
- Variables
- type IndexOptions
- type IndexStore
- type Iterable
- type Iterator
- type Reader
- type ScanFunc
- type ScanOpts
- type Store
- type StoreOptions
- type TimeSeriesOptions
- func TSSWithEncoding(encoderPool encoding.SeriesEncoderPool, decoderPool encoding.SeriesDecoderPool, ...) TimeSeriesOptions
- func TSSWithLogger(l *logger.Logger) TimeSeriesOptions
- func TSSWithMemTableSize(sizeInBytes int64) TimeSeriesOptions
- func TSSWithZSTDCompression(chunkSize int) TimeSeriesOptions
- type TimeSeriesReader
- type TimeSeriesStore
- type TimeSeriesWriter
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultScanOpts is a helper to provides canonical options for scanning. DefaultScanOpts = ScanOpts{ PrefetchSize: 100, PrefetchValues: true, } )
var (
// ErrKeyNotFound denotes the expected key can not be got from the kv service.
ErrKeyNotFound = badger.ErrKeyNotFound
)
Functions ¶
This section is empty.
Types ¶
type IndexOptions ¶
type IndexOptions func(store IndexStore)
IndexOptions sets options for creating the index store.
func IndexWithLogger ¶
func IndexWithLogger(l *logger.Logger) IndexOptions
IndexWithLogger sets a external logger into underlying IndexStore.
type IndexStore ¶
type IndexStore interface { observability.Observable Iterable Reader Close() error }
IndexStore allows writing and reading index format data.
func OpenIndexStore ¶
func OpenIndexStore(path string, options ...IndexOptions) (IndexStore, error)
OpenIndexStore creates a new IndexStore.
type Iterator ¶
type Iterator interface { Next() Rewind() Seek(key []byte) Key() []byte RawKey() []byte Val() []byte Valid() bool Close() error }
Iterator allows iterating the kv tables. TODO: use generic to provide a unique iterator.
type Reader ¶
type Reader interface { Iterable // Get a value by its key Get(key []byte) ([]byte, error) GetAll(key []byte, applyFn func([]byte) error) error Scan(prefix, seekKey []byte, opt ScanOpts, f ScanFunc) error }
Reader allows retrieving data from kv.
type Store ¶
type Store interface { observability.Observable io.Closer Reader // contains filtered or unexported methods }
Store is a common kv storage with auto-generated key.
type StoreOptions ¶
type StoreOptions func(Store)
StoreOptions sets options for creating Store.
func StoreWithLogger ¶
func StoreWithLogger(l *logger.Logger) StoreOptions
StoreWithLogger sets a external logger into underlying Store.
func StoreWithMemTableSize ¶ added in v0.2.0
func StoreWithMemTableSize(size int64) StoreOptions
StoreWithMemTableSize sets MemTable size.
func StoreWithNamedLogger ¶
func StoreWithNamedLogger(name string, l *logger.Logger) StoreOptions
StoreWithNamedLogger sets a external logger with a name into underlying Store.
type TimeSeriesOptions ¶
type TimeSeriesOptions func(TimeSeriesStore)
TimeSeriesOptions sets an options for creating a TimeSeriesStore.
func TSSWithEncoding ¶
func TSSWithEncoding(encoderPool encoding.SeriesEncoderPool, decoderPool encoding.SeriesDecoderPool, chunkSize int) TimeSeriesOptions
TSSWithEncoding sets encoding and decoding pools for building chunks.
func TSSWithLogger ¶
func TSSWithLogger(l *logger.Logger) TimeSeriesOptions
TSSWithLogger sets a external logger into underlying TimeSeriesStore.
func TSSWithMemTableSize ¶ added in v0.2.0
func TSSWithMemTableSize(sizeInBytes int64) TimeSeriesOptions
TSSWithMemTableSize sets the size of memory table in bytes.
func TSSWithZSTDCompression ¶ added in v0.3.0
func TSSWithZSTDCompression(chunkSize int) TimeSeriesOptions
TSSWithZSTDCompression sets a ZSTD based compression method.
type TimeSeriesReader ¶
type TimeSeriesReader interface { // Get a value by its key and timestamp/version Get(key []byte, ts uint64) ([]byte, error) }
TimeSeriesReader allows retrieving data from a time-series storage.
type TimeSeriesStore ¶
type TimeSeriesStore interface { observability.Observable io.Closer TimeSeriesWriter TimeSeriesReader }
TimeSeriesStore is time series storage.
func OpenTimeSeriesStore ¶
func OpenTimeSeriesStore(path string, options ...TimeSeriesOptions) (TimeSeriesStore, error)
OpenTimeSeriesStore creates a new TimeSeriesStore. nolint: contextcheck
type TimeSeriesWriter ¶
type TimeSeriesWriter interface { // Put a value with a timestamp/version Put(key, val []byte, ts uint64) error // PutAsync a value with a timestamp/version asynchronously. // Injected "f" func will notice the result of value write. PutAsync(key, val []byte, ts uint64, f func(error)) error }
TimeSeriesWriter allows writing to a time-series storage.