db

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func RegisterAmino

func RegisterAmino(cdc *amino.Codec)

Types

type RWSet

type RWSet 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) ToSet

func (m *RWSetMap) ToSet() *RWSet

type RWSets

type RWSets struct {
	Address common.Address
	RWSet   *RWSet
	Childs  []*RWSets
}

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 State

type State struct {
	Childs []*RWSets
}

func (*State) Add

func (s *State) Add(rws *RWSets)

type StateDB

type StateDB interface {
	Set(k, v []byte) error
	Get(k []byte) ([]byte, 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
}

type VersionedDB

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

func NewVersionedDB

func NewVersionedDB(store types.KVStore, version Version) *VersionedDB

func (*VersionedDB) Commit

func (db *VersionedDB) Commit() (*RWSet, error)

func (*VersionedDB) Get

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

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