database

package
v0.0.0-...-7cc22e0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deserialize

func Deserialize(b []byte, t interface{}) (interface{}, error)

func Serialize

func Serialize(t interface{}) []byte

func SetupDB

func SetupDB(path string) *database

Types

type DB

type DB interface {
	SaveBlock(block *types.Block, sender, miner string, wo *opt.WriteOptions) error
	LastBlock(ro *opt.ReadOptions) (*types.Block, error)
	// retrieve block by hash
	GetBlockH(hash []byte, ro *opt.ReadOptions) (*types.Block, error)
	// retrieve block by index
	GetBlockI(index uint64, ro *opt.ReadOptions) (*types.Block, error)
	// retrieve block hash by index
	GetBlkHash(index uint64, ro *opt.ReadOptions) ([]byte, error)

	SaveState(ss map[types.Account][]*types.UTXO, height uint64, wo *opt.WriteOptions) error
	ReadState() (map[types.Account][]*types.UTXO, error)
}

Jump to

Keyboard shortcuts

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