scoredb

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ArrayDBPrefix = 0x00
	DictDBPrefix  = 0x01
	VarDBPrefix   = 0x02
)

Variables

This section is empty.

Functions

func AppendKeys

func AppendKeys(key []byte, keys ...interface{}) []byte

func ToBytes

func ToBytes(v interface{}) []byte

func ToKey

func ToKey(prefix byte, keys ...interface{}) []byte

Types

type ArrayDB

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

func NewArrayDB

func NewArrayDB(store StateStore, keys ...interface{}) *ArrayDB

func (*ArrayDB) Get

func (a *ArrayDB) Get(i int) Value

func (*ArrayDB) Pop

func (a *ArrayDB) Pop() Value

func (*ArrayDB) Put

func (a *ArrayDB) Put(v interface{}) error

func (*ArrayDB) Set

func (a *ArrayDB) Set(i int, v interface{}) error

func (*ArrayDB) Size

func (a *ArrayDB) Size() int

type BytesStore

type BytesStore interface {
	Bytes() []byte
	SetBytes([]byte) error
	Delete() error
}

type DictDB

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

func NewDictDB

func NewDictDB(store StateStore, name interface{}, depth int) *DictDB

func (*DictDB) Delete

func (d *DictDB) Delete(kv ...interface{}) error

func (*DictDB) Get

func (d *DictDB) Get(keys ...interface{}) Value

func (*DictDB) GetDB

func (d *DictDB) GetDB(keys ...interface{}) *DictDB

func (*DictDB) Set

func (d *DictDB) Set(params ...interface{}) error

type ReadOnlyStore

type ReadOnlyStore interface {
	GetValue(key []byte) ([]byte, error)
}

type StateStore

type StateStore interface {
	GetValue(key []byte) ([]byte, error)
	SetValue(key []byte, value []byte) ([]byte, error)
	DeleteValue(key []byte) ([]byte, error)
}

func NewStateStoreWith

func NewStateStoreWith(s ReadOnlyStore) StateStore

type Value

type Value interface {
	BigInt() *big.Int
	Int64() int64
	Address() module.Address
	Bytes() []byte
	String() string
	Bool() bool
}

func NewValueFromBytes

func NewValueFromBytes(bs []byte) Value

type VarDB

type VarDB struct {
	WritableValue
}

func NewVarDB

func NewVarDB(store StateStore, key ...interface{}) *VarDB

type WritableValue

type WritableValue interface {
	Value
	Delete() error
	Set(interface{}) error
}

func NewValueFromStore

func NewValueFromStore(store StateStore, kbytes []byte) WritableValue

Jump to

Keyboard shortcuts

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