Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IteratorBackend ¶
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 ¶
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) KeysByRange(from []byte, to []byte, limit int) ([][]byte, error) BeginBatch() error CommitBatch() error Size() (int64, error) Close() error NewIteratorByPrefix(prefix []byte) any }
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.