Documentation ¶
Index ¶
- Constants
- Variables
- type Batch
- type Database
- type LevelDB
- func (db *LevelDB) Close()
- func (db *LevelDB) Delete(key []byte) error
- func (db *LevelDB) Get(key []byte) ([]byte, error)
- func (db *LevelDB) Has(key []byte) (bool, error)
- func (db *LevelDB) LDB() *leveldb.DB
- func (db *LevelDB) Meter(prefix string)
- func (db *LevelDB) NewBatch() Batch
- func (db *LevelDB) NewIterator() iterator.Iterator
- func (db *LevelDB) NewIteratorWithPrefix(prefix []byte) iterator.Iterator
- func (db *LevelDB) Path() string
- func (db *LevelDB) Put(key []byte, value []byte) error
- type LevelDBConfig
- type MemDBConfig
- type MemDatabase
- func (db *MemDatabase) Close()
- func (db *MemDatabase) Delete(key []byte) error
- func (db *MemDatabase) Get(key []byte) ([]byte, error)
- func (db *MemDatabase) Has(key []byte) (bool, error)
- func (db *MemDatabase) Keys() [][]byte
- func (db *MemDatabase) Len() int
- func (db *MemDatabase) NewBatch() Batch
- func (db *MemDatabase) Put(key []byte, value []byte) error
- type Putter
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 OpenFileLimit = 64
Functions ¶
This section is empty.
Types ¶
type Batch ¶
type Batch interface { Putter ValueSize() int // amount of data in the batch Write() error // Reset resets the batch for reuse Reset() }
Batch is a write-only database that commits changes to its host database when Write is called. Batch cannot be used concurrently.
func NewTableBatch ¶
NewTableBatch returns a Batch object which prefixes all keys with a given string.
type Database ¶
type Database interface { Putter Get(key []byte) ([]byte, error) Has(key []byte) (bool, error) Delete(key []byte) error Close() NewBatch() Batch }
Database wraps all database operations. All methods are safe for concurrent use.
type LevelDB ¶
type LevelDB struct {
// contains filtered or unexported fields
}
func NewLevelDB ¶
NewLevelDB returns a LevelDB wrapped object.
func (*LevelDB) NewIterator ¶
func (*LevelDB) NewIteratorWithPrefix ¶
NewIteratorWithPrefix returns a iterator to iterate over subset of database content with a particular prefix.
type LevelDBConfig ¶
type MemDBConfig ¶
type MemDBConfig struct{}
type MemDatabase ¶
type MemDatabase struct {
// contains filtered or unexported fields
}
* This is a test memory database. Do not use for any production it does not get persisted
func NewMemDatabase ¶
func NewMemDatabase() *MemDatabase
func NewMemDatabaseWithCap ¶
func NewMemDatabaseWithCap(size int) *MemDatabase
func (*MemDatabase) Close ¶
func (db *MemDatabase) Close()
func (*MemDatabase) Delete ¶
func (db *MemDatabase) Delete(key []byte) error
func (*MemDatabase) Keys ¶
func (db *MemDatabase) Keys() [][]byte
func (*MemDatabase) Len ¶
func (db *MemDatabase) Len() int
func (*MemDatabase) NewBatch ¶
func (db *MemDatabase) NewBatch() Batch
Click to show internal directories.
Click to hide internal directories.