Documentation ¶
Index ¶
- Constants
- Variables
- type Batch
- type Deleter
- type Getter
- type LevelStorage
- func (storage *LevelStorage) Close() error
- func (storage *LevelStorage) Del(key []byte) error
- func (storage *LevelStorage) Get(key []byte) ([]byte, error)
- func (storage *LevelStorage) GetLevelDB() *leveldb.DB
- func (storage *LevelStorage) Has(key []byte) (bool, error)
- func (storage *LevelStorage) NewBatch() Batch
- func (storage *LevelStorage) Put(key []byte, value []byte) error
- type MemoryStorage
- func (db *MemoryStorage) Close() error
- func (db *MemoryStorage) Del(key []byte) error
- func (db *MemoryStorage) Get(key []byte) ([]byte, error)
- func (db *MemoryStorage) Has(key []byte) (bool, error)
- func (db *MemoryStorage) NewBatch() Batch
- func (db *MemoryStorage) Put(key []byte, value []byte) error
- type Putter
- type Storage
Constants ¶
View Source
const IdealBatchSize = 100 * 1024
Code using batches should try to add this much data to the batch. The value was determined empirically.
Variables ¶
View Source
var (
ErrKeyNotFound = errors.New("not found")
)
Functions ¶
This section is empty.
Types ¶
type LevelStorage ¶
type LevelStorage struct {
// contains filtered or unexported fields
}
func NewLevelStorage ¶
func NewLevelStorage(path string) (*LevelStorage, error)
func (*LevelStorage) Close ¶
func (storage *LevelStorage) Close() error
func (*LevelStorage) Del ¶
func (storage *LevelStorage) Del(key []byte) error
func (*LevelStorage) GetLevelDB ¶
func (storage *LevelStorage) GetLevelDB() *leveldb.DB
func (*LevelStorage) NewBatch ¶
func (storage *LevelStorage) NewBatch() Batch
type MemoryStorage ¶
type MemoryStorage struct {
// contains filtered or unexported fields
}
func NewMemoryStorage ¶
func NewMemoryStorage() *MemoryStorage
func (*MemoryStorage) Close ¶
func (db *MemoryStorage) Close() error
func (*MemoryStorage) Del ¶
func (db *MemoryStorage) Del(key []byte) error
func (*MemoryStorage) NewBatch ¶
func (db *MemoryStorage) NewBatch() Batch
Click to show internal directories.
Click to hide internal directories.