db

package
v1.2.14 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: Apache-2.0 Imports: 12 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 GetSupportedTypes added in v1.1.1

func GetSupportedTypes() []string

func NewNullDB

func NewNullDB() *nullDB

func NewProxyDB

func NewProxyDB() *proxyDB

func RegisterHasher added in v1.2.9

func RegisterHasher(bk BucketID, hasher Hasher)

func RegisteredBackendTypes added in v0.9.10

func RegisteredBackendTypes() []string

Types

type BackendType

type BackendType string
const GoLevelDBBackend BackendType = "goleveldb"
const MapDBBackend BackendType = "mapdb"

type Bucket

type Bucket interface {
	Get(key []byte) ([]byte, error)
	Has(key []byte) (bool, error)
	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

func (BucketID) Hasher added in v1.2.9

func (bk BucketID) Hasher() Hasher

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, hasher Hasher, 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 Hasher added in v1.2.9

type Hasher interface {
	Name() string
	Hash(value []byte) []byte
}

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