database

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package database provides KV database for meta-information

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("key not found")
)

Errors for Storage

Functions

func RecoverDB added in v0.5.1

func RecoverDB(path string) error

RecoverDB recovers LevelDB database from corruption

Types

type Storage

type Storage interface {
	CreateTemporary() (Storage, error)
	Get(key []byte) ([]byte, error)
	Put(key []byte, value []byte) error
	Delete(key []byte) error
	HasPrefix(prefix []byte) bool
	ProcessByPrefix(prefix []byte, proc StorageProcessor) error
	KeysByPrefix(prefix []byte) [][]byte
	FetchByPrefix(prefix []byte) [][]byte
	Close() error
	ReOpen() error
	StartBatch()
	FinishBatch() error
	CompactDB() error
	Drop() error
}

Storage is an interface to KV storage

func OpenDB

func OpenDB(path string) (Storage, error)

OpenDB opens (creates) LevelDB database

type StorageProcessor added in v1.0.0

type StorageProcessor func(key []byte, value []byte) error

StorageProcessor is a function to process one single storage entry

Jump to

Keyboard shortcuts

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