storage

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: Apache-2.0 Imports: 3 Imported by: 3 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

type StatisticalStorage interface {
	// Stats storage status
	Stats() stats.Stats
}

StatisticalStorage statistical storage

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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