db

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: Apache-2.0 Imports: 7 Imported by: 4

Documentation

Index

Constants

View Source
const (
	VersionSize = 8
)

Variables

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

Functions

func CommitState added in v0.4.1

func CommitState(db sdk.KVStore, sets RWSets, version Version, m KeyMaps) error

func RegisterAmino

func RegisterAmino(cdc *amino.Codec)

Types

type KeyMap added in v0.4.4

type KeyMap map[string]struct{}

KeyMap contains updated key

func NewKeyMap added in v0.4.4

func NewKeyMap() KeyMap

func (KeyMap) Has added in v0.4.4

func (m KeyMap) Has(k string) bool

func (KeyMap) Set added in v0.4.4

func (m KeyMap) Set(k string)

type KeyMaps added in v0.4.4

type KeyMaps struct {
	Read  map[common.Address]KeyMap
	Write map[common.Address]KeyMap
}

func NewKeyMaps added in v0.4.4

func NewKeyMaps() KeyMaps

func (*KeyMaps) GetReadKeyMap added in v0.4.4

func (m *KeyMaps) GetReadKeyMap(addr common.Address) KeyMap

func (*KeyMaps) GetWriteKeyMap added in v0.4.4

func (m *KeyMaps) GetWriteKeyMap(addr common.Address) KeyMap

type RWSet

type RWSet struct {
	Address common.Address
	Items   *RWSetItems
}

type RWSetItems added in v0.4.1

type RWSetItems struct {
	ReadSet  []Read
	WriteSet []Write
}

type RWSetMap

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

func NewRWSetMap

func NewRWSetMap() *RWSetMap

func (*RWSetMap) AddRead

func (m *RWSetMap) AddRead(key []byte, version Version) bool

func (*RWSetMap) AddWrite

func (m *RWSetMap) AddWrite(key, value []byte)

func (*RWSetMap) GetRead

func (m *RWSetMap) GetRead(key []byte) (Read, bool)

func (*RWSetMap) GetWrite

func (m *RWSetMap) GetWrite(key []byte) (Write, bool)

func (*RWSetMap) ToItems added in v0.4.1

func (m *RWSetMap) ToItems() *RWSetItems

type RWSets

type RWSets []*RWSet

func (*RWSets) Add added in v0.4.1

func (rs *RWSets) Add(ss ...*RWSet)

func (RWSets) Bytes

func (rs RWSets) Bytes() ([]byte, error)

func (*RWSets) FromBytes

func (rs *RWSets) FromBytes(b []byte) error

func (RWSets) Hash

func (rs RWSets) Hash() []byte

type Read

type Read struct {
	Key     []byte
	Version Version
}

type StateDB

type StateDB interface {
	Set(k, v []byte) error
	Get(k []byte) ([]byte, error)
}

type StateManager added in v0.4.1

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

func NewStateManager added in v0.4.1

func NewStateManager(key sdk.StoreKey) *StateManager

func (StateManager) CommitState added in v0.4.1

func (sm StateManager) CommitState(ctx sdk.Context, sets RWSets) error

type ValueObject

type ValueObject struct {
	Value   []byte
	Version Version
}

func BytesToValueObject

func BytesToValueObject(b []byte) (*ValueObject, error)

func (ValueObject) Marshal

func (vo ValueObject) Marshal() []byte

func (*ValueObject) Unmarshal

func (vo *ValueObject) Unmarshal(b []byte) error

type Version

type Version struct {
	Height uint32
	TxIdx  uint32
}

func MakeVersion added in v0.4.0

func MakeVersion(b []byte) (Version, error)

func (Version) Bytes added in v0.4.0

func (v Version) Bytes() []byte

type VersionedDB

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

func NewVersionedDB

func NewVersionedDB(store types.KVStore) *VersionedDB

func (*VersionedDB) Get

func (db *VersionedDB) Get(k []byte) ([]byte, error)

func (*VersionedDB) RWSetItems added in v0.4.1

func (db *VersionedDB) RWSetItems() *RWSetItems

func (*VersionedDB) Set

func (db *VersionedDB) Set(k, v []byte) error

type Write

type Write struct {
	Key   []byte
	Value []byte
}

Jump to

Keyboard shortcuts

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