storage

package
v0.0.0-...-f23cd05 Latest Latest
Warning

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

Go to latest
Published: May 2, 2019 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ERROR_MSG = "Initiate storage aborted: "
)

Variables

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

	AllClosedBlocksAsc []*protocol.Block
	Bootstrap_Server   string
)

Functions

func DeleteAll

func DeleteAll()

func DeleteAllLastClosedBlock

func DeleteAllLastClosedBlock()

func DeleteClosedBlock

func DeleteClosedBlock(hash [32]byte)

func DeleteClosedTx

func DeleteClosedTx(transaction protocol.Transaction)

func DeleteINVALIDOpenTx

func DeleteINVALIDOpenTx(transaction protocol.Transaction)

func DeleteLastClosedBlock

func DeleteLastClosedBlock(hash [32]byte)

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 GetAccTxPubKeys

func GetAccTxPubKeys(accTxData [][32]byte) (accTxPubKeys [][32]byte)

Get all pubKey involved in AccTx

func GetAccount

func GetAccount(hash [32]byte) (acc *protocol.Account, err error)

Needed by miner and p2p package

func GetFundsTxPubKeys

func GetFundsTxPubKeys(fundsTxData [][32]byte) (fundsTxPubKeys [][32]byte)

Get all pubKey involved in FundsTx

func GetRootAccount

func GetRootAccount(hash [32]byte) (acc *protocol.Account, err error)

func GetTxPubKeys

func GetTxPubKeys(block *protocol.Block) (txPubKeys [][32]byte)

Get all pubKeys involved in AccTx, FundsTx of a given block

func Init

func Init(dbname string, bootstrapIpport string)

Entry function for the storage package

func InitLogger

func InitLogger() *log.Logger

func IsRootKey

func IsRootKey(hash [32]byte) bool

func PrintMemPoolSize

func PrintMemPoolSize()

func ReadAllClosedBlocks

func ReadAllClosedBlocks() (allClosedBlocks []*protocol.Block)

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 ReadINVALIDOpenTx

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

func ReadLastClosedBlock

func ReadLastClosedBlock() (block *protocol.Block)

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 ReadReceivedBlockStash

func ReadReceivedBlockStash() (receivedBlocks []*protocol.Block)

func TearDown

func TearDown()

func WriteClosedBlock

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

func WriteClosedTx

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

func WriteINVALIDOpenTx

func WriteINVALIDOpenTx(transaction protocol.Transaction)

func WriteLastClosedBlock

func WriteLastClosedBlock(block *protocol.Block) (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

func WriteToReceivedStash

func WriteToReceivedStash(block *protocol.Block)

Types

This section is empty.

Jump to

Keyboard shortcuts

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