storage

package
v0.0.0-...-01d9b8a Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataStorage

type DataStorage interface {
	MetadataStorage

	// 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, splitKey []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 MetadataStorage

type MetadataStorage interface {
	// 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
	// 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)

	// Close close the storage
	Close() error
}

MetadataStorage the storage to save raft log, shard and store metadata.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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