Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloseableStorage ¶
type CloseableStorage interface { // Close close the storage Close() error }
CloseableStorage is a closeable storage
type DataStorage ¶
type DataStorage interface { StatisticalStorage CloseableStorage // Sync sync data data to persistent device Sync() error // RemoveShardData remove shard data RemoveShardData(shard bhmetapb.Shard, encodedStartKey, encodedEndKey []byte) error // SplitCheck Find a key from [start, end), so that the sum of bytes of the value of [start, key) <=size, // returns the current bytes in [start,end), and the founded key SplitCheck(start []byte, end []byte, size uint64) (currentSize uint64, currentKeys uint64, splitKeys [][]byte, err error) // CreateSnapshot create a snapshot file under the giving path CreateSnapshot(path string, start, end []byte) error // ApplySnapshot apply a snapshort file from giving path ApplySnapshot(path string) error }
DataStorage responsible for maintaining the data storage of a set of shards for the application.
type KVStorage ¶
type KVStorage interface { CloseableStorage // Write write the data in batch Write(wb *util.WriteBatch, sync bool) error // Set put the key, value pair to the storage Set(key []byte, value []byte) error // SetWithTTL put the key, value pair to the storage with a ttl in seconds SetWithTTL(key []byte, value []byte, ttl int32) error // Get returns the value of the key Get(key []byte) ([]byte, error) // MGet get multi values MGet(keys ...[]byte) ([][]byte, error) // Delete remove the key from the storage Delete(key []byte) error // Scan scans the key-value paire in [start, end), and perform with a handler function, if the function // returns false, the scan will be terminated, if the `pooledKey` is true, raftstore will call `Free` when // scan completed. Scan(start, end []byte, handler func(key, value []byte) (bool, error), pooledKey bool) error // PrefixScan scans the key-value pairs starts from prefix but only keys for the same prefix, // while perform with a handler function, if the function returns false, the scan will be terminated. // if the `pooledKey` is true, raftstore will call `Free` when // scan completed. PrefixScan(prefix []byte, handler func(key, value []byte) (bool, error), pooledKey bool) error // Free free the pooled bytes Free(pooled []byte) // RangeDelete delete data in [start,end). RangeDelete(start, end []byte) error // Seek returns the first key-value that >= key Seek(key []byte) ([]byte, []byte, error) }
KVStorage is KV based storage
type MetadataStorage ¶
type MetadataStorage interface { StatisticalStorage KVStorage CloseableStorage }
MetadataStorage the storage to save raft log, shard and store metadata.
type StatisticalStorage ¶
StatisticalStorage statistical storage
Click to show internal directories.
Click to hide internal directories.