Documentation ¶
Index ¶
- Variables
- func RecordMetrics(storage *RocksStorage)
- type DiskStorage
- func (storage *DiskStorage) Close() error
- func (storage *DiskStorage) Del(key []byte) error
- func (storage *DiskStorage) DisableBatch()
- func (storage *DiskStorage) EnableBatch()
- func (storage *DiskStorage) Flush() error
- func (storage *DiskStorage) Get(key []byte) ([]byte, error)
- func (storage *DiskStorage) Put(key []byte, value []byte) error
- type MemoryBatch
- type MemoryStorage
- type RocksStorage
- func (storage *RocksStorage) Close() error
- func (storage *RocksStorage) Del(key []byte) error
- func (storage *RocksStorage) DisableBatch()
- func (storage *RocksStorage) EnableBatch()
- func (storage *RocksStorage) Flush() error
- func (storage *RocksStorage) Get(key []byte) ([]byte, error)
- func (storage *RocksStorage) Put(key []byte, value []byte) error
- type Storage
Constants ¶
This section is empty.
Variables ¶
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) 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.
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.
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.
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.