leveldb

package
v0.0.0-...-b124b1e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
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) Close

func (db *LDBDatabase) Close()

Close close database instance

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) LDB

func (db *LDBDatabase) LDB() *leveldb.DB

LDB returns ldb instance

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.

func (*LDBDatabase) Put

func (db *LDBDatabase) Put(key []byte, value []byte) error

Put puts the given key / value to the queue

type NewStorageFunc

type NewStorageFunc func(*KVParameter) (storage.Database, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL