dbutils

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLevelDB

func CreateLevelDB(path string, errorIfExist bool) error

Initial a level db If leveldb already exists, return error

func CreateLevelDBWithInitData

func CreateLevelDBWithInitData(path, key string, data []byte, errorIfExist bool) error

Types

type LevelDBUtils

type LevelDBUtils struct {
	// contains filtered or unexported fields
}

func OpenLevelDB

func OpenLevelDB(path string, readonly bool) (*LevelDBUtils, error)

Open a leveldb If leveldb is corrupted, try to recover it If leveldb is EAGAIN, retry to open it in 1 minutes If leveldb is missing, return a error instead create one

func (*LevelDBUtils) Close

func (l *LevelDBUtils) Close() error

It is safe to close a no-open LevelDBUtils

func (*LevelDBUtils) CompactFirstKey

func (l *LevelDBUtils) CompactFirstKey() error

func (*LevelDBUtils) CompactKey

func (l *LevelDBUtils) CompactKey(key []byte) error

func (*LevelDBUtils) Get

func (l *LevelDBUtils) Get(key []byte) (value []byte, err error)

func (*LevelDBUtils) GetSize

func (l *LevelDBUtils) GetSize() (int, error)

Get db's total size

func (*LevelDBUtils) ListAll

func (l *LevelDBUtils) ListAll() (map[string]string, error)

func (*LevelDBUtils) ListAllKeys

func (l *LevelDBUtils) ListAllKeys() ([]string, error)

func (*LevelDBUtils) Put

func (l *LevelDBUtils) Put(key []byte, val []byte) error

Jump to

Keyboard shortcuts

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