db

package
v0.9.10 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoGet added in v0.9.7

func DoGet(bk Bucket, key []byte) ([]byte, error)

func DoGetWithBucketID added in v0.9.8

func DoGetWithBucketID(dbase Database, bid BucketID, key []byte) ([]byte, error)

func GetFlag added in v0.9.4

func GetFlag(database Database, name string) interface{}

func NewNullDB

func NewNullDB() *nullDB

func NewProxyDB

func NewProxyDB() *proxyDB

func RegisteredBackendTypes added in v0.9.10

func RegisteredBackendTypes() []string

Types

type BackendType

type BackendType string
const (
	BadgerDBBackend  BackendType = "badgerdb"
	GoLevelDBBackend BackendType = "goleveldb"
	BoltDBBackend    BackendType = "boltdb"
	MapDBBackend     BackendType = "mapdb"
)

type BadgerDB

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

func NewBadgerDB

func NewBadgerDB(name string, dir string) (*BadgerDB, error)

func (*BadgerDB) Close

func (db *BadgerDB) Close() error

func (*BadgerDB) GetBucket

func (db *BadgerDB) GetBucket(id BucketID) (Bucket, error)

type BoltDB

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

func NewBoltDB

func NewBoltDB(name string, dir string) (*BoltDB, error)

func (*BoltDB) Close

func (db *BoltDB) Close() error

func (*BoltDB) GetBucket

func (db *BoltDB) GetBucket(id BucketID) (Bucket, error)

type Bucket

type Bucket interface {
	Get(key []byte) ([]byte, error)
	Has(key []byte) bool
	Set(key []byte, value []byte) error
	Delete(key []byte) error
}

Bucket

type BucketID

type BucketID string
const (
	// MerkleTrie maps RLP encoded data from sha3(data)
	MerkleTrie BucketID = ""

	// BytesByHash maps data except merkle trie nodes from sha3(data)
	BytesByHash BucketID = "S"

	// TransactionLocatorByHash maps transaction locator from transaction hash.
	TransactionLocatorByHash BucketID = "T"

	// BlockHeaderHashByHeight maps hash of encoded block header from height.
	BlockHeaderHashByHeight BucketID = "H"

	// ChainProperty is general key value map for chain property.
	ChainProperty BucketID = "C"
)

Bucket ID

type CodedBucket added in v0.9.6

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

func NewCodedBucket added in v0.9.6

func NewCodedBucket(database Database, id BucketID, c codec.Codec) (*CodedBucket, error)

func NewCodedBucketFromBucket added in v0.9.7

func NewCodedBucketFromBucket(bk Bucket, c codec.Codec) *CodedBucket

func (*CodedBucket) Get added in v0.9.6

func (b *CodedBucket) Get(key interface{}, value interface{}) error

func (*CodedBucket) GetBytes added in v0.9.6

func (b *CodedBucket) GetBytes(key interface{}) ([]byte, error)

func (*CodedBucket) Put added in v0.9.6

func (b *CodedBucket) Put(value interface{}) error

func (*CodedBucket) Set added in v0.9.6

func (b *CodedBucket) Set(key interface{}, value interface{}) error

type Context added in v0.9.4

type Context interface {
	Database
	ContextBuilder
	GetFlag(n string) interface{}
	Flags() Flags
}

func WithFlags added in v0.9.4

func WithFlags(database Database, flags Flags) Context

type ContextBuilder added in v0.9.4

type ContextBuilder interface {
	WithFlags(flags Flags) Context
}

type Database

type Database interface {
	GetBucket(id BucketID) (Bucket, error)
	Close() error
}

func NewMapDB

func NewMapDB() Database

func Open

func Open(dir, dbtype, name string) (Database, error)

type Flags added in v0.9.4

type Flags map[string]interface{}

func (Flags) Clone added in v0.9.4

func (f Flags) Clone() Flags

func (Flags) Get added in v0.9.4

func (f Flags) Get(n string) interface{}

func (Flags) Merged added in v0.9.4

func (f Flags) Merged(flags Flags) Flags

type GoLevelDB

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

func NewGoLevelDB

func NewGoLevelDB(name string, dir string) (*GoLevelDB, error)

func NewGoLevelDBWithOpts

func NewGoLevelDBWithOpts(name string, dir string, o *opt.Options) (*GoLevelDB, error)

func (*GoLevelDB) Close

func (db *GoLevelDB) Close() error

func (*GoLevelDB) GetBucket

func (db *GoLevelDB) GetBucket(id BucketID) (Bucket, error)

type LayerDB

type LayerDB interface {
	Database
	Flush(write bool) error
}

func NewLayerDB

func NewLayerDB(database Database) LayerDB

type Raw added in v0.9.6

type Raw []byte

Jump to

Keyboard shortcuts

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