Documentation ¶
Index ¶
- Constants
- Variables
- func NewBytesPrefix(prefix []byte) *ldbutil.Range
- func SetCacheRatio(db string, ratio float64)
- func SetHandleRatio(db string, ratio float64)
- type Batch
- type Database
- type LDBDatabase
- func (self *LDBDatabase) Close()
- func (self *LDBDatabase) Delete(key []byte) error
- func (self *LDBDatabase) Get(key []byte) ([]byte, error)
- func (db *LDBDatabase) Has(key []byte) (bool, error)
- func (self *LDBDatabase) LDB() *leveldb.DB
- func (db *LDBDatabase) NewBatch() Batch
- func (self *LDBDatabase) NewIterator() iterator.Iterator
- func (self *LDBDatabase) NewIteratorRange(slice *ldbutil.Range) iterator.Iterator
- func (db *LDBDatabase) Path() string
- func (self *LDBDatabase) Put(key []byte, value []byte) error
- 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) NewBatch() Batch
- func (db *MemDatabase) Put(key []byte, value []byte) error
- func (db *MemDatabase) Set(key []byte, value []byte)
- 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 ¶
func NewBytesPrefix ¶
func SetCacheRatio ¶
func SetHandleRatio ¶
Types ¶
type Batch ¶ added in v1.4.0
func NewTableBatch ¶
NewTableBatch returns a Batch object which prefixes all keys with a given string.
type Database ¶ added in v1.4.0
type LDBDatabase ¶
type LDBDatabase struct {
// contains filtered or unexported fields
}
func NewLDBDatabase ¶
func NewLDBDatabase(file string, cache int, handles int) (*LDBDatabase, error)
NewLDBDatabase returns a LevelDB wrapped object.
func (*LDBDatabase) Close ¶
func (self *LDBDatabase) Close()
func (*LDBDatabase) Delete ¶
func (self *LDBDatabase) Delete(key []byte) error
Delete deletes the key from the queue and database
func (*LDBDatabase) Get ¶
func (self *LDBDatabase) Get(key []byte) ([]byte, error)
Get returns the given key if it's present.
func (*LDBDatabase) LDB ¶
func (self *LDBDatabase) LDB() *leveldb.DB
func (*LDBDatabase) NewBatch ¶ added in v1.4.0
func (db *LDBDatabase) NewBatch() Batch
func (*LDBDatabase) NewIterator ¶
func (self *LDBDatabase) NewIterator() iterator.Iterator
func (*LDBDatabase) NewIteratorRange ¶
func (self *LDBDatabase) NewIteratorRange(slice *ldbutil.Range) iterator.Iterator
func (*LDBDatabase) Path ¶
func (db *LDBDatabase) Path() string
Path returns the path to the database directory.
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, error)
func (*MemDatabase) Close ¶
func (db *MemDatabase) Close()
func (*MemDatabase) Delete ¶
func (db *MemDatabase) Delete(key []byte) error
func (*MemDatabase) Keys ¶ added in v1.4.0
func (db *MemDatabase) Keys() [][]byte
func (*MemDatabase) NewBatch ¶ added in v1.4.0
func (db *MemDatabase) NewBatch() Batch
func (*MemDatabase) Set ¶
func (db *MemDatabase) Set(key []byte, value []byte)
Click to show internal directories.
Click to hide internal directories.