kv

package
v3.2.7-0...-70c9be9 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: Apache-2.0 Imports: 1 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(ctx raftio.IContext) 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 SimpleWriteBatch

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

SimpleWriteBatch is a write batch used in tests.

func NewSimpleWriteBatch

func NewSimpleWriteBatch() *SimpleWriteBatch

NewSimpleWriteBatch ...

func (*SimpleWriteBatch) Clear

func (wb *SimpleWriteBatch) Clear()

Clear ...

func (*SimpleWriteBatch) Count

func (wb *SimpleWriteBatch) Count() int

Count ...

func (*SimpleWriteBatch) Delete

func (wb *SimpleWriteBatch) Delete(key []byte)

Delete ...

func (*SimpleWriteBatch) Destroy

func (wb *SimpleWriteBatch) Destroy()

Destroy ...

func (*SimpleWriteBatch) Put

func (wb *SimpleWriteBatch) Put(key []byte, val []byte)

Put ...

Directories

Path Synopsis
levigo
Package levigo provides the ability to create and access LevelDB databases.
Package levigo provides the ability to create and access LevelDB databases.
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