leveldb

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package leveldb contains ledger implementation on top of Go's LevelDB engine

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound returns if record/index not found in leveldb storage.
	ErrNotFound = errors.New("record not found")
)

Functions

func DropDB

func DropDB() error

Types

type LevelLedger

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

LevelLedger represents ledger's LevelDB storage.

func InitDB

func InitDB() (*LevelLedger, error)

InitDB returns LevelLedger with LevelDB initialized with default settings.

func (*LevelLedger) Close

func (ll *LevelLedger) Close() error

Close terminates db connection

func (*LevelLedger) GetClassIndex

func (ll *LevelLedger) GetClassIndex(ref *record.Reference) (*index.ClassLifeline, error)

GetClassIndex fetches lifeline index from leveldb

func (*LevelLedger) GetObjectIndex

func (ll *LevelLedger) GetObjectIndex(ref *record.Reference) (*index.ObjectLifeline, error)

GetObjectIndex fetches lifeline index from leveldb

func (*LevelLedger) GetRecord

func (ll *LevelLedger) GetRecord(ref *record.Reference) (record.Record, error)

GetRecord returns record from leveldb by *record.Reference.

It returns ErrNotFound if the DB does not contains the key.

func (*LevelLedger) SetClassIndex

func (ll *LevelLedger) SetClassIndex(ref *record.Reference, idx *index.ClassLifeline) error

SetClassIndex stores lifeline index into leveldb

func (*LevelLedger) SetObjectIndex

func (ll *LevelLedger) SetObjectIndex(ref *record.Reference, idx *index.ObjectLifeline) error

SetObjectIndex stores lifeline index into leveldb

func (*LevelLedger) SetRecord

func (ll *LevelLedger) SetRecord(rec record.Record) (*record.Reference, error)

SetRecord stores record in leveldb

Jump to

Keyboard shortcuts

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