storage

package
v0.0.0-...-d507fa0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	State    = make(map[[32]byte]*protocol.Account)
	RootKeys = make(map[[32]byte]*protocol.Account)
)

Functions

func DeleteAll

func DeleteAll()

func DeleteClosedBlock

func DeleteClosedBlock(hash [32]byte)

func DeleteClosedTx

func DeleteClosedTx(transaction protocol.Transaction)

func DeleteOpenBlock

func DeleteOpenBlock(hash [32]byte)

There exist open/closed buckets and closed tx buckets for all types (open txs are in volatile storage)

func DeleteOpenTx

func DeleteOpenTx(transaction protocol.Transaction)

func GetAccountFromHash

func GetAccountFromHash(hash [32]byte) *protocol.Account

Needed by miner and p2p package

func Init

func Init(dbname string)

Entry function for the storage package

func ReadAllOpenTxs

func ReadAllOpenTxs() (allOpenTxs []protocol.Transaction)

Needed for the miner to prepare a new block

func ReadClosedBlock

func ReadClosedBlock(hash [32]byte) (block *protocol.Block)

func ReadClosedTx

func ReadClosedTx(hash [32]byte) (transaction protocol.Transaction)

Personally I like it better to test (which tx type it is) here, and get returned the interface. Simplifies the code

func ReadOpenBlock

func ReadOpenBlock(hash [32]byte) (block *protocol.Block)

Always return nil if requested hash is not in the storage. This return value is then checked against by the caller

func ReadOpenTx

func ReadOpenTx(hash [32]byte) (transaction protocol.Transaction)

func TearDown

func TearDown()

func WriteClosedBlock

func WriteClosedBlock(block *protocol.Block) (err error)

func WriteClosedTx

func WriteClosedTx(transaction protocol.Transaction) (err error)

func WriteOpenBlock

func WriteOpenBlock(block *protocol.Block) (err error)

func WriteOpenTx

func WriteOpenTx(transaction protocol.Transaction)

Changing the "tx" shortcut here and using "transaction" to distinguish between bolt's transactions

Types

This section is empty.

Jump to

Keyboard shortcuts

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