Documentation ¶
Index ¶
- Variables
- func ComputeTxsRoot(txs []types.Transaction) util.Hash
- func ExecAllowed(opts ...types.CallOp) bool
- func HasTxOp(opts ...types.CallOp) bool
- func MakeKeyAccount(blockNum uint64, chainID, address []byte) []byte
- func MakeKeyBlock(chainID []byte, blockNumber uint64) []byte
- func MakeKeyBlockHash(chainID []byte, hash []byte) []byte
- func MakeKeyChain(chainID []byte) []byte
- func MakeKeyMinedBlock(chainID []byte, blockNumber uint64) []byte
- func MakeKeyReOrg(timestamp int64) []byte
- func MakeKeyTransaction(chainID []byte, blockNumber uint64, txHash []byte) []byte
- func MakeQueryKeyAccount(chainID, address []byte) []byte
- func MakeQueryKeyAccounts(chainID []byte) []byte
- func MakeQueryKeyBlocks(chainID []byte) []byte
- func MakeQueryKeyChains() []byte
- func MakeQueryKeyMinedBlocks(chainID []byte) []byte
- func MakeQueryKeyReOrg() []byte
- func MakeQueryKeyTransaction(chainID []byte, txHash []byte) []byte
- func MakeQueryKeyTransactions(chainID []byte) []byte
- func MakeTreeKey(blockNumber uint64, objectType []byte) []byte
- type DocType
- type Object
- type OpAllowExec
- type OpBase
- type OpBlockQueryRange
- type OpChainer
- type OpCreateAccount
- type OpNewAccountBalance
- type OpTransitions
- type OpTx
- type OrphanBlock
- type StateObject
- type Transition
- type Tree
- type TreeItem
Constants ¶
This section is empty.
Variables ¶
var ( // TagAccount represents an account object TagAccount = []byte("a") // TagChain represents a chain object TagChain = []byte("c") // TagBlock represents a block object TagBlock = []byte("b") // TagBlockNumber represents a block object TagBlockNumber = []byte("n") // TagChainInfo represents a chain information object TagChainInfo = []byte("i") // TagTransaction represents a transaction object TagTransaction = []byte("t") // TagReOrg represents a meta object TagReOrg = []byte("r") // TagMinedBlock represents a mined block data TagMinedBlockHeader = []byte("m") )
Functions ¶
func ComputeTxsRoot ¶
func ComputeTxsRoot(txs []types.Transaction) util.Hash
ComputeTxsRoot computes the merkle root of a set of transactions.
func ExecAllowed ¶
ExecAllowed is a convenience method to get the value of OpAllowExec
func MakeKeyAccount ¶
MakeKeyAccount constructs a key for storing an account. Prefixes: tag_chain + chain ID + tag_account + address + block number (big endian)
func MakeKeyBlock ¶
MakeKeyBlock constructs a key for storing a block. Prefixes: tag_chain + chain ID + tag_block + block number (big endian)
func MakeKeyBlockHash ¶
MakeKeyBlockHash constructs a key for storing the number of a block with a matching hash. Prefixes: tag_chain + chain ID + tag_block + block hash
func MakeKeyChain ¶
MakeKeyChain constructs a key for storing chain information. Prefixes: tag_chain_info + chain ID
func MakeKeyMinedBlock ¶
MakeKeyMinedBlock constructs a key for recording information about blocks mined
func MakeKeyReOrg ¶
MakeKeyReOrg constructs a key for storing reorganization info. Prefixes: tag_reOrg + timestamp (big endian)
func MakeKeyTransaction ¶
MakeKeyTransaction constructs a key for storing a transaction. Prefixes: tag_chain + chain ID + tag_transaction + transaction hash + block number (big endian)
func MakeQueryKeyAccount ¶
MakeQueryKeyAccount constructs a key for finding account data in the store and hash tree. Prefixes: tag_chain + chain ID + tag_account + address
func MakeQueryKeyAccounts ¶
MakeQueryKeyAccounts constructs a key for querying all accounts in a given chain. Prefixes: tag_chain + chain ID + tag_account
func MakeQueryKeyBlocks ¶
MakeQueryKeyBlocks constructs a key for querying all blocks in given chain. Prefixes: tag_chain + chain ID + tag_block
func MakeQueryKeyChains ¶
func MakeQueryKeyChains() []byte
MakeQueryKeyChains constructs a key to find all chain information. Prefixes: tag_chain_info
func MakeQueryKeyMinedBlocks ¶
MakeQueryKeyMinedBlocks constructs a key for querying all mined blocks in given chain. Prefixes: tag_chain + chain ID + tag_mined_block
func MakeQueryKeyReOrg ¶
func MakeQueryKeyReOrg() []byte
MakeQueryKeyReOrg constructs a key for querying reorganization core. Prefixes: tag_reOrg
func MakeQueryKeyTransaction ¶
MakeQueryKeyTransaction constructs a key for querying a transaction. Prefixes: tag_chain + chain ID + tag_transaction + transaction hash
func MakeQueryKeyTransactions ¶
MakeQueryKeyTransactions constructs a key for querying all transactions in a chain. Prefixes: tag_chain + chain ID + tag_transaction
func MakeTreeKey ¶
MakeTreeKey constructs a key for recording state objects in a tree. Combination: block number (big endian) + object type
Types ¶
type OpAllowExec ¶
type OpAllowExec bool
OpAllowExec defines a CallOp that indicates whether to execute something
func (OpAllowExec) GetName ¶
func (t OpAllowExec) GetName() string
GetName implements core.CallOp. Allows transitions
type OpBase ¶
OpBase includes common methods and fields for a transition object
func (*OpBase) Equal ¶
func (o *OpBase) Equal(t Transition) bool
Equal checks whether a Transition t is equal to o
type OpBlockQueryRange ¶
OpBlockQueryRange defines the minimum and maximum block number of objects to access.
func GetBlockQueryRangeOp ¶
func GetBlockQueryRangeOp(opts ...types.CallOp) *OpBlockQueryRange
GetBlockQueryRangeOp is a convenience method to get QueryBlockRange option from a slice of CallOps
func (*OpBlockQueryRange) GetName ¶
func (o *OpBlockQueryRange) GetName() string
GetName returns the name of the op
type OpChainer ¶
OpChainer defines a CallOp for passing a chain
func GetChainerOp ¶
GetChainerOp is a convenience method to get ChainerOp option from a slice of CallOps
type OpCreateAccount ¶
OpCreateAccount describes a transition to create an account
func (*OpCreateAccount) Equal ¶
func (o *OpCreateAccount) Equal(t Transition) bool
Equal checks whether a Transition t is equal to o
type OpNewAccountBalance ¶
OpNewAccountBalance represents a transition to a new account balance
func (*OpNewAccountBalance) Equal ¶
func (o *OpNewAccountBalance) Equal(t Transition) bool
Equal checks whether a Transition t is equal to o
type OpTransitions ¶
type OpTransitions []Transition
OpTransitions defines a CallOp for passing transition objects
func (*OpTransitions) GetName ¶
func (t *OpTransitions) GetName() string
GetName implements core.CallOp. Allows transitions
type OpTx ¶
OpTx is used to pass transactions to methods
func GetTxOp ¶
GetTxOp checks and return a transaction added in the supplied call option slice. If none is found, a new transaction is created and returned as a TxOp.
func (*OpTx) Commit ¶
Commit commits the transaction if it has not been done before. It ignores the call if CanFinish is false.
func (*OpTx) Discard ¶
Discard the transaction. Do not call functions in the transaction after this.
func (*OpTx) Finishable ¶
Finishable makes the transaction finishable
func (*OpTx) Rollback ¶
Rollback rolls back the transaction if it has not been done before. It ignores the call if CanFinish is false.
func (*OpTx) SetFinishable ¶
SetFinishable sets whether the transaction can be finished
type OrphanBlock ¶
OrphanBlock represents an orphan block
type StateObject ¶
type StateObject struct { // Key represents the key to use // to persist the object to database Key []byte // Value is the content of this state // object. It is written to the database // and the tree Value []byte }
StateObject describes an object to be stored in a elldb.StateObject. Usually created after processing a Transition object.
type Transition ¶
type Transition interface { // Address returns the address this transition is to affect Address() util.String // Equal is used to check whether a transition operation t is similar Equal(t Transition) bool }
Transition represents a mutation to the state of a chain
func GetTransitions ¶
func GetTransitions(opts ...types.CallOp) (transitions []Transition)
GetTransitions finds a Transitions option from a given slice of call options and returns a slice of transition objects
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree provides merkle tree functionality with the ability to persist the tree content to a storage.
func NewTree ¶
func NewTree() *Tree
NewTree creates an instance of Tree and accepts storage module that implements common.Storer.
func (*Tree) Add ¶
func (t *Tree) Add(item merkletree.Content)
Add adds an item to collection of items to be used to build the tree
func (*Tree) GetItems ¶
func (t *Tree) GetItems() []merkletree.Content
GetItems returns the tree items Needs tests
type TreeItem ¶
type TreeItem []byte
TreeItem represents an item to be added to the tree
func (TreeItem) CalculateHash ¶
CalculateHash returns the blake2b-256 hash of the item