Documentation ¶
Index ¶
- Constants
- func CreateKVInstance(kvParam *KVParameter) (storage.Database, error)
- func NewKVDBInstance(param *KVParameter) (storage.Database, error)
- func Register(name string, f NewStorageFunc)
- type KVParameter
- func (param *KVParameter) GetDBPath() string
- func (param *KVParameter) GetFileHandlersCacheSize() int
- func (param *KVParameter) GetKVEngineType() string
- func (param *KVParameter) GetMemCacheSize() int
- func (param *KVParameter) GetOtherPaths() []string
- func (param *KVParameter) GetStorageType() string
- type LDBDatabase
- func (db *LDBDatabase) Close()
- func (db *LDBDatabase) Delete(key []byte) error
- func (db *LDBDatabase) Get(key []byte) ([]byte, error)
- func (db *LDBDatabase) Has(key []byte) (bool, error)
- func (db *LDBDatabase) LDB() *leveldb.DB
- func (db *LDBDatabase) NewBatch() storage.Batch
- func (db *LDBDatabase) NewIterator() storage.Iterator
- func (db *LDBDatabase) NewIteratorWithPrefix(prefix []byte) storage.Iterator
- func (db *LDBDatabase) NewIteratorWithRange(start []byte, limit []byte) storage.Iterator
- func (db *LDBDatabase) Open(path string, options map[string]interface{}) error
- func (ldb *LDBDatabase) OpenSingle(path string, options map[string]interface{}) error
- func (db *LDBDatabase) Path() string
- func (db *LDBDatabase) Put(key []byte, value []byte) error
- type NewStorageFunc
Constants ¶
const ( KVEngineType = "leveldb" StorageTypeSingle = "single" )
Variables ¶
This section is empty.
Functions ¶
func CreateKVInstance ¶
func CreateKVInstance(kvParam *KVParameter) (storage.Database, error)
func NewKVDBInstance ¶
func NewKVDBInstance(param *KVParameter) (storage.Database, error)
GetInstance get instance of LDBDatabase
func Register ¶
func Register(name string, f NewStorageFunc)
Types ¶
type KVParameter ¶
type KVParameter struct { DBPath string KVEngineType string StorageType string MemCacheSize int FileHandlersCacheSize int OtherPaths []string Options map[string]interface{} }
KVParameter structure for kv instance parameters
func (*KVParameter) GetDBPath ¶
func (param *KVParameter) GetDBPath() string
GetDBPath return the value of DBPath
func (*KVParameter) GetFileHandlersCacheSize ¶
func (param *KVParameter) GetFileHandlersCacheSize() int
GetFileHandlersCacheSize return the value of FileHandlersCacheSize
func (*KVParameter) GetKVEngineType ¶
func (param *KVParameter) GetKVEngineType() string
GetKVEngineType return the value of KVEngineType
func (*KVParameter) GetMemCacheSize ¶
func (param *KVParameter) GetMemCacheSize() int
GetMemCacheSize return the value of MemCacheSize
func (*KVParameter) GetOtherPaths ¶
func (param *KVParameter) GetOtherPaths() []string
GetOtherPaths return the value of OtherPaths
func (*KVParameter) GetStorageType ¶
func (param *KVParameter) GetStorageType() string
GetStorageType return the value of GetStorageType
type LDBDatabase ¶
type LDBDatabase struct {
// contains filtered or unexported fields
}
LDBDatabase define data structure of storage
func (*LDBDatabase) Delete ¶
func (db *LDBDatabase) Delete(key []byte) error
Delete deletes the key from the queue and database
func (*LDBDatabase) Get ¶
func (db *LDBDatabase) Get(key []byte) ([]byte, error)
Get returns the given key if it's present.
func (*LDBDatabase) Has ¶
func (db *LDBDatabase) Has(key []byte) (bool, error)
Has if the given key exists
func (*LDBDatabase) NewBatch ¶
func (db *LDBDatabase) NewBatch() storage.Batch
NewBatch returns batch instance of ldb
func (*LDBDatabase) NewIterator ¶
func (db *LDBDatabase) NewIterator() storage.Iterator
NewIterator returns an instance of Iterator
func (*LDBDatabase) NewIteratorWithPrefix ¶
func (db *LDBDatabase) NewIteratorWithPrefix(prefix []byte) storage.Iterator
NewIteratorWithPrefix returns an instance of Iterator with prefix
func (*LDBDatabase) NewIteratorWithRange ¶
func (db *LDBDatabase) NewIteratorWithRange(start []byte, limit []byte) storage.Iterator
NewIteratorWithRange returns an instance of Iterator with range
func (*LDBDatabase) Open ¶
func (db *LDBDatabase) Open(path string, options map[string]interface{}) error
func (*LDBDatabase) OpenSingle ¶
func (ldb *LDBDatabase) OpenSingle(path string, options map[string]interface{}) error
Open opens an instance of LDB with parameters (ldb path and other options)
func (*LDBDatabase) Path ¶
func (db *LDBDatabase) Path() string
Path returns the path to the database directory.
type NewStorageFunc ¶
type NewStorageFunc func(*KVParameter) (storage.Database, error)