storage

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2019 License: LGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyNotFound = errors.New("not found")
)

const

Functions

func RecordMetrics added in v1.0.2

func RecordMetrics(storage *RocksStorage)

RecordMetrics record rocksdb metrics

Types

type DiskStorage added in v0.3.0

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

DiskStorage the nodes in trie.

func NewDiskStorage added in v0.3.0

func NewDiskStorage(path string) (*DiskStorage, error)

NewDiskStorage init a storage

func (*DiskStorage) Close added in v0.3.0

func (storage *DiskStorage) Close() error

Close levelDB

func (*DiskStorage) Del added in v0.3.0

func (storage *DiskStorage) Del(key []byte) error

Del delete the key in Storage.

func (*DiskStorage) DisableBatch added in v1.0.0

func (storage *DiskStorage) DisableBatch()

DisableBatch disable batch write.

func (*DiskStorage) EnableBatch added in v1.0.0

func (storage *DiskStorage) EnableBatch()

EnableBatch enable batch write.

func (*DiskStorage) Flush added in v1.0.0

func (storage *DiskStorage) Flush() error

Flush write and flush pending batch write.

func (*DiskStorage) Get added in v0.3.0

func (storage *DiskStorage) Get(key []byte) ([]byte, error)

Get return value to the key in Storage

func (*DiskStorage) Put added in v0.3.0

func (storage *DiskStorage) Put(key []byte, value []byte) error

Put put the key-value entry to Storage

type MemoryBatch added in v1.0.0

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

MemoryBatch do batch task in memory storage

type MemoryStorage added in v0.3.0

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

MemoryStorage the nodes in trie.

func NewMemoryStorage added in v0.3.0

func NewMemoryStorage() (*MemoryStorage, error)

NewMemoryStorage init a storage

func (*MemoryStorage) Del added in v0.3.0

func (db *MemoryStorage) Del(key []byte) error

Del delete the key in Storage.

func (*MemoryStorage) DisableBatch added in v1.0.0

func (db *MemoryStorage) DisableBatch()

DisableBatch disable batch write.

func (*MemoryStorage) EnableBatch added in v1.0.0

func (db *MemoryStorage) EnableBatch()

EnableBatch enable batch write.

func (*MemoryStorage) Flush added in v1.0.0

func (db *MemoryStorage) Flush() error

Flush write and flush pending batch write.

func (*MemoryStorage) Get added in v0.3.0

func (db *MemoryStorage) Get(key []byte) ([]byte, error)

Get return value to the key in Storage

func (*MemoryStorage) Put added in v0.3.0

func (db *MemoryStorage) Put(key []byte, value []byte) error

Put put the key-value entry to Storage

type RocksStorage added in v1.0.0

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

RocksStorage the nodes in trie.

func NewRocksStorage added in v1.0.0

func NewRocksStorage(path string) (*RocksStorage, error)

NewRocksStorage init a storage

func (*RocksStorage) Close added in v1.0.0

func (storage *RocksStorage) Close() error

Close levelDB

func (*RocksStorage) Del added in v1.0.0

func (storage *RocksStorage) Del(key []byte) error

Del delete the key in Storage.

func (*RocksStorage) DisableBatch added in v1.0.0

func (storage *RocksStorage) DisableBatch()

DisableBatch disable batch write.

func (*RocksStorage) EnableBatch added in v1.0.0

func (storage *RocksStorage) EnableBatch()

EnableBatch enable batch write.

func (*RocksStorage) Flush added in v1.0.0

func (storage *RocksStorage) Flush() error

Flush write and flush pending batch write.

func (*RocksStorage) Get added in v1.0.0

func (storage *RocksStorage) Get(key []byte) ([]byte, error)

Get return value to the key in Storage

func (*RocksStorage) Put added in v1.0.0

func (storage *RocksStorage) Put(key []byte, value []byte) error

Put put the key-value entry to Storage

type Storage

type Storage interface {
	// Get return the value to the key in Storage.
	Get(key []byte) ([]byte, error)

	// Put put the key-value entry to Storage.
	Put(key []byte, value []byte) error

	// Del delete the key entry in Storage.
	Del(key []byte) error

	// EnableBatch enable batch write.
	EnableBatch()

	// DisableBatch disable batch write.
	DisableBatch()

	// Flush write and flush pending batch write.
	Flush() error
}

Storage interface of Storage.

Jump to

Keyboard shortcuts

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