storage

package
v0.0.0-...-ac41614 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PUT      = iota
	DEL      = iota
	FORWARD  = iota
	BACKWARD = iota
)

Variables

View Source
var (
	CopyBatchSize     = 1000
	CopyBatchMaxBytes = 5 * 1024 * 1024 // 5 MB
)

Functions

This section is empty.

Types

type Batch

type Batch struct {
	BatchOps map[string]Op `json:"ops"`
}

func NewBatch

func NewBatch() *Batch

func (*Batch) Delete

func (batch *Batch) Delete(key []byte) *Batch

func (*Batch) Ops

func (batch *Batch) Ops() map[string]Op

func (*Batch) Put

func (batch *Batch) Put(key []byte, value []byte) *Batch

func (*Batch) Size

func (batch *Batch) Size() int

func (*Batch) SortedOps

func (batch *Batch) SortedOps() []Op

type LevelDBIterator

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

func (*LevelDBIterator) Error

func (it *LevelDBIterator) Error() error

func (*LevelDBIterator) Key

func (it *LevelDBIterator) Key() []byte

func (*LevelDBIterator) Next

func (it *LevelDBIterator) Next() bool

func (*LevelDBIterator) Prefix

func (it *LevelDBIterator) Prefix() []byte

func (*LevelDBIterator) Release

func (it *LevelDBIterator) Release()

func (*LevelDBIterator) Value

func (it *LevelDBIterator) Value() []byte

type LevelDBStorageDriver

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

func NewLevelDBStorageDriver

func NewLevelDBStorageDriver(file string, options *opt.Options) *LevelDBStorageDriver

func (*LevelDBStorageDriver) Batch

func (levelDriver *LevelDBStorageDriver) Batch(batch *Batch) error

func (*LevelDBStorageDriver) Close

func (levelDriver *LevelDBStorageDriver) Close() error

func (*LevelDBStorageDriver) Compact

func (levelDriver *LevelDBStorageDriver) Compact() error

func (*LevelDBStorageDriver) Get

func (levelDriver *LevelDBStorageDriver) Get(keys [][]byte) ([][]byte, error)

func (*LevelDBStorageDriver) GetMatches

func (levelDriver *LevelDBStorageDriver) GetMatches(keys [][]byte) (StorageIterator, error)

func (*LevelDBStorageDriver) GetRange

func (levelDriver *LevelDBStorageDriver) GetRange(min, max []byte) (StorageIterator, error)

func (*LevelDBStorageDriver) GetRanges

func (levelDriver *LevelDBStorageDriver) GetRanges(ranges [][2][]byte, direction int) (StorageIterator, error)

func (*LevelDBStorageDriver) Open

func (levelDriver *LevelDBStorageDriver) Open() error

func (*LevelDBStorageDriver) OpenSnapshot

func (levelDriver *LevelDBStorageDriver) OpenSnapshot(snapshotDirectory string) (StorageDriver, error)

func (*LevelDBStorageDriver) Recover

func (levelDriver *LevelDBStorageDriver) Recover() error

func (*LevelDBStorageDriver) Restore

func (levelDriver *LevelDBStorageDriver) Restore(storageDriver StorageDriver) error

func (*LevelDBStorageDriver) Snapshot

func (levelDriver *LevelDBStorageDriver) Snapshot(snapshotDirectory string, metadataPrefix []byte, metadata map[string]string) error

type Op

type Op struct {
	OpType  int    `json:"type"`
	OpKey   []byte `json:"key"`
	OpValue []byte `json:"value"`
}

func (*Op) IsDelete

func (o *Op) IsDelete() bool

func (*Op) IsPut

func (o *Op) IsPut() bool

func (*Op) Key

func (o *Op) Key() []byte

func (*Op) Value

func (o *Op) Value() []byte

type OpList

type OpList []Op

func (OpList) Len

func (opList OpList) Len() int

func (OpList) Less

func (opList OpList) Less(i, j int) bool

func (OpList) Swap

func (opList OpList) Swap(i, j int)

type PrefixedIterator

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

func NewPrefixedIterator

func NewPrefixedIterator(iter StorageIterator, prefix []byte) *PrefixedIterator

func (*PrefixedIterator) Error

func (prefixedIterator *PrefixedIterator) Error() error

func (*PrefixedIterator) Key

func (prefixedIterator *PrefixedIterator) Key() []byte

func (*PrefixedIterator) Next

func (prefixedIterator *PrefixedIterator) Next() bool

func (*PrefixedIterator) Prefix

func (prefixedIterator *PrefixedIterator) Prefix() []byte

func (*PrefixedIterator) Release

func (prefixedIterator *PrefixedIterator) Release()

func (*PrefixedIterator) Value

func (prefixedIterator *PrefixedIterator) Value() []byte

type PrefixedStorageDriver

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

func NewPrefixedStorageDriver

func NewPrefixedStorageDriver(prefix []byte, storageDriver StorageDriver) *PrefixedStorageDriver

func (*PrefixedStorageDriver) Batch

func (psd *PrefixedStorageDriver) Batch(batch *Batch) error

func (*PrefixedStorageDriver) Close

func (psd *PrefixedStorageDriver) Close() error

func (*PrefixedStorageDriver) Compact

func (psd *PrefixedStorageDriver) Compact() error

func (*PrefixedStorageDriver) Get

func (psd *PrefixedStorageDriver) Get(keys [][]byte) ([][]byte, error)

func (*PrefixedStorageDriver) GetMatches

func (psd *PrefixedStorageDriver) GetMatches(keys [][]byte) (StorageIterator, error)

func (*PrefixedStorageDriver) GetRange

func (psd *PrefixedStorageDriver) GetRange(start []byte, end []byte) (StorageIterator, error)

func (*PrefixedStorageDriver) GetRanges

func (psd *PrefixedStorageDriver) GetRanges(ranges [][2][]byte, direction int) (StorageIterator, error)

func (*PrefixedStorageDriver) Open

func (psd *PrefixedStorageDriver) Open() error

func (*PrefixedStorageDriver) OpenSnapshot

func (psd *PrefixedStorageDriver) OpenSnapshot(snapshotDirectory string) (StorageDriver, error)

func (*PrefixedStorageDriver) Recover

func (psd *PrefixedStorageDriver) Recover() error

func (*PrefixedStorageDriver) Restore

func (psd *PrefixedStorageDriver) Restore(storageDriver StorageDriver) error

func (*PrefixedStorageDriver) Snapshot

func (psd *PrefixedStorageDriver) Snapshot(snapshotDirectory string, metadataPrefix []byte, metadata map[string]string) error

type StorageDriver

type StorageDriver interface {
	Open() error
	Close() error
	Recover() error
	Compact() error
	Get([][]byte) ([][]byte, error)
	GetMatches([][]byte) (StorageIterator, error)
	GetRange([]byte, []byte) (StorageIterator, error)
	GetRanges([][2][]byte, int) (StorageIterator, error)
	Batch(*Batch) error
	Snapshot(snapshotDirectory string, metadataPrefix []byte, metadata map[string]string) error
	OpenSnapshot(snapshotDirectory string) (StorageDriver, error)
	Restore(storageDriver StorageDriver) error
}

type StorageIterator

type StorageIterator interface {
	Next() bool
	Prefix() []byte
	Key() []byte
	Value() []byte
	Release()
	Error() error
}

Jump to

Keyboard shortcuts

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