Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Iterator ¶ added in v1.1.0
type Iterator struct {
IteratorBackend
}
Iterator is the storage iterator
type IteratorBackend ¶ added in v1.1.0
IteratorBackend is the storage iterator backend
type Storage ¶
type Storage struct {
StorageBackend
}
Storage is a kv database
func NewStorage ¶
func NewStorage(path string, t StorageType) (*Storage, error)
NewStorage return the storage of the specify type
func (*Storage) NewIteratorByPrefix ¶ added in v1.1.0
NewIteratorByPrefix returns a new iterator by prefix
type StorageBackend ¶
type StorageBackend interface { Get(key []byte) ([]byte, error) Put(key []byte, value []byte) error Has(key []byte) (bool, error) Delete(key []byte) error Keys(prefix []byte) ([][]byte, error) BeginBatch() error CommitBatch() error Close() error NewIteratorByPrefix(prefix []byte) interface{} }
StorageBackend is the storage backend interface
type StorageType ¶
type StorageType uint8
StorageType is the type of storage, include leveldb and rocksdb
const (
LevelDBStorage StorageType
)
Storage type constant
Click to show internal directories.
Click to hide internal directories.