Documentation ¶
Index ¶
- func CreateLevelDB(path string, errorIfExist bool) error
- func CreateLevelDBWithInitData(path, key string, data []byte, errorIfExist bool) error
- type LevelDBUtils
- func (l *LevelDBUtils) Close() error
- func (l *LevelDBUtils) CompactFirstKey() error
- func (l *LevelDBUtils) CompactKey(key []byte) error
- func (l *LevelDBUtils) Get(key []byte) (value []byte, err error)
- func (l *LevelDBUtils) GetSize() (int, error)
- func (l *LevelDBUtils) ListAll() (map[string]string, error)
- func (l *LevelDBUtils) ListAllKeys() ([]string, error)
- func (l *LevelDBUtils) Put(key []byte, val []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateLevelDB ¶
Initial a level db If leveldb already exists, return 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) ListAllKeys ¶
func (l *LevelDBUtils) ListAllKeys() ([]string, error)
Click to show internal directories.
Click to hide internal directories.