kv

package
v3.3.100 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxKeyLength is the max length of keys allowed
	MaxKeyLength uint64 = 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IKVStore

type IKVStore interface {
	// Name is the IKVStore name.
	Name() string
	// Close closes the underlying Key-Value store.
	Close() error
	// IterateValue iterates the key range specified by the first key fk and
	// last key lk. The inc boolean flag indicates whether it is inclusive for
	// the last key lk. For each iterated entry, the specified op will be invoked
	// on that key-value pair, the specified op func returns a boolean flag to
	// indicate whether IterateValue should continue to iterate entries.
	IterateValue(fk []byte,
		lk []byte, inc bool, op func(key []byte, data []byte) (bool, error)) error
	// GetValue queries the value specified the input key, the returned value
	// byte slice is passed to the specified op func.
	GetValue(key []byte, op func([]byte) error) error
	// Save value saves the specified key value pair to the underlying key-value
	// pair.
	SaveValue(key []byte, value []byte) error
	// DeleteValue deletes the key-value pair specified by the input key.
	DeleteValue(key []byte) error
	// GetWriteBatch returns an IWriteBatch object to be used by RDB.
	GetWriteBatch() IWriteBatch
	// CommitWriteBatch atomically writes everything included in the write batch
	// to the underlying key-value store.
	CommitWriteBatch(wb IWriteBatch) error
	// BulkRemoveEntries removes entries specified by the range [firstKey,
	// lastKey). BulkRemoveEntries is called in the main execution thread of raft,
	// it is suppose to immediately return without significant delay.
	// BulkRemoveEntries is usually implemented in KV store's range delete feature.
	BulkRemoveEntries(firstKey []byte, lastKey []byte) error
	// CompactEntries reclaims the underlying disk space used for storing entries
	// specified the input range.
	CompactEntries(firstKey []byte, lastKey []byte) error
	// FullCompaction compact the entire key space.
	FullCompaction() error
}

IKVStore is the interface used by the RDB struct to access the underlying Key-Value store.

type IWriteBatch

type IWriteBatch interface {
	Destroy()
	Put([]byte, []byte)
	Delete([]byte)
	Clear()
	Count() int
}

IWriteBatch is the interface representing a write batch capable of atomically writing many key-value pairs to the key-value store.

type LogDBCallback

type LogDBCallback func(busy bool)

LogDBCallback is a callback function called by the LogDB

Directories

Path Synopsis
gorocksdb
Package gorocksdb provides the ability to create and access RocksDB databases.
Package gorocksdb provides the ability to create and access RocksDB databases.

Jump to

Keyboard shortcuts

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