Documentation ¶
Index ¶
Constants ¶
View Source
const Unlimited = 0
Variables ¶
View Source
var (
ErrNotFound = errors.New("not found")
)
Functions ¶
func Register ¶
func Register(reg *Registration)
Types ¶
type BatchPut ¶
type BatchPut struct {
// contains filtered or unexported fields
}
func NewBatchPut ¶
func (*BatchPut) ShouldFlush ¶
type Compressor ¶
func NewCompressor ¶
func NewCompressor(mode string) (Compressor, error)
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator can end in any of those scenarios:
- PushError() is called by the db backend
- PushComplete() is called by the db backend and Next() is called by consumer until items channel is empty
- The context given by the consumer is cancelled, notifying the db backend and (hopefully) causing a PushError() to be called with context.Canceled
In any of these cases, the following call to Next() returns false.
Assumptions:
* Next() must never be called again after it returned `false` * No other Push...() function is called PushFinished() or PushError(). * Next(), Item() and Error() are never called concurrently. * PushItem(), PushFinished() and PushError() are never called concurrently. * If the reader wants to finish early, it should close the context to prevent waste
func NewIterator ¶
NewIterator provides a streaming resultset for key/value queries
func (*Iterator) PushFinished ¶
func (it *Iterator) PushFinished()
type KVStore ¶
type KVStore interface { // Put writes to a transaction, which might be flushed from time to time. Call FlushPuts() to ensure all Put entries are properly written to the database. Put(ctx context.Context, key, value []byte) (err error) // FlushPuts takes any pending writes (calls to Put()), and flushes them. FlushPuts(ctx context.Context) (err error) // Get a given key. Returns `kvdb.ErrNotFound` if not found. Get(ctx context.Context, key []byte) (value []byte, err error) // Get a batch of keys. Returns `kvdb.ErrNotFound` the first time a key is not found: not finding a key is fatal and interrupts the resultset from being fetched completely. BatchGet guarantees that Iterator return results in the exact same order as keys BatchGet(ctx context.Context, keys [][]byte) *Iterator Scan(ctx context.Context, start, exclusiveEnd []byte, limit int) *Iterator Prefix(ctx context.Context, prefix []byte, limit int) *Iterator BatchPrefix(ctx context.Context, prefixes [][]byte, limit int) *Iterator }
type NewStoreFunc ¶
NewStoreFunc is a function for opening a databse.
type NoOpCompressor ¶
type NoOpCompressor struct{}
func NewNoOpCompressor ¶
func NewNoOpCompressor() *NoOpCompressor
func (NoOpCompressor) Compress ¶
func (NoOpCompressor) Compress(in []byte) []byte
func (NoOpCompressor) Decompress ¶
func (NoOpCompressor) Decompress(in []byte) ([]byte, error)
type Option ¶
type Option string
const ( // TIKV does not support empty values, thus the consumer of KVDB needs // to let the underlying driver (i.e. TIVK) know that the values may // be empty ( i.e. flux writing keys with no values to signify deletion) // in which case said driver woudl take that into account when // writing and reading data WithEmptyValueSupport Option = "WithEmptyValueSupport" )
type Registration ¶
type Registration struct { Name string // unique name Title string // human-readable name FactoryFunc NewStoreFunc }
type ReversibleKVStore ¶
type ZstdCompressor ¶
type ZstdCompressor struct {
// contains filtered or unexported fields
}
func NewZstdCompressor ¶
func NewZstdCompressor() *ZstdCompressor
func (*ZstdCompressor) Compress ¶
func (c *ZstdCompressor) Compress(in []byte) (out []byte)
func (*ZstdCompressor) Decompress ¶
func (c *ZstdCompressor) Decompress(in []byte) ([]byte, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.