Documentation ¶
Index ¶
- Variables
- func QcFromGenesisState(partitionRecords []*genesis.GenesisPartitionRecord) *drctypes.QuorumCert
- func ReadLastTC(db keyvaluedb.KeyValueDB) (*abtypes.TimeoutCert, error)
- func ReadVote(db keyvaluedb.KeyValueDB) (any, error)
- func ToRecoveryInputData(data []*InputData) []*abdrc.InputData
- func UnicityCertificatesFromGenesis(pg []*genesis.GenesisPartitionRecord) map[types.SystemID]*types.UnicityCertificate
- func WriteLastTC(db keyvaluedb.KeyValueDB, tc *abtypes.TimeoutCert) error
- func WriteVote(db keyvaluedb.KeyValueDB, vote any) error
- type BlockStore
- func (x *BlockStore) Add(block *drctypes.BlockData, verifier IRChangeReqVerifier) ([]byte, error)
- func (x *BlockStore) Block(round uint64) (*ExecutedBlock, error)
- func (x *BlockStore) GetCertificate(id types.SystemID) (*types.UnicityCertificate, error)
- func (x *BlockStore) GetCertificates() map[types.SystemID]*types.UnicityCertificate
- func (x *BlockStore) GetDB() keyvaluedb.KeyValueDB
- func (x *BlockStore) GetHighQc() *drctypes.QuorumCert
- func (x *BlockStore) GetLastTC() (*drctypes.TimeoutCert, error)
- func (x *BlockStore) GetState() *abdrc.StateMsg
- func (x *BlockStore) IsChangeInProgress(sysId types.SystemID) *types.InputRecord
- func (x *BlockStore) ProcessQc(qc *drctypes.QuorumCert) (map[types.SystemID]*types.UnicityCertificate, error)
- func (x *BlockStore) ProcessTc(tc *drctypes.TimeoutCert) (rErr error)
- func (x *BlockStore) ReadLastVote() (any, error)
- func (x *BlockStore) StoreLastVote(vote any) error
- type BlockTree
- func (bt *BlockTree) Add(block *ExecutedBlock) error
- func (bt *BlockTree) Commit(commitQc *abdrc.QuorumCert) (execBlock *ExecutedBlock, err error)
- func (bt *BlockTree) FindBlock(round uint64) (*ExecutedBlock, error)
- func (bt *BlockTree) FindPathToRoot(round uint64) []*ExecutedBlock
- func (bt *BlockTree) GetAllUncommittedNodes() []*ExecutedBlock
- func (bt *BlockTree) HighQc() *abdrc.QuorumCert
- func (bt *BlockTree) InsertQc(qc *abdrc.QuorumCert) error
- func (bt *BlockTree) RemoveLeaf(round uint64) error
- func (bt *BlockTree) Root() *ExecutedBlock
- type ExecutedBlock
- func NewExecutedBlock(hash gocrypto.Hash, newBlock *drctypes.BlockData, parent *ExecutedBlock, ...) (*ExecutedBlock, error)
- func NewGenesisBlock(hash gocrypto.Hash, pg []*genesis.GenesisPartitionRecord) *ExecutedBlock
- func NewRootBlock(hash gocrypto.Hash, block *abdrc.CommittedBlock) (*ExecutedBlock, error)
- type IRChangeReqVerifier
- type InputData
- type InputRecords
- type SysIDList
- type VoteStore
- type VoteType
Constants ¶
This section is empty.
Variables ¶
var (
ErrCommitFailed = errors.New("commit failed")
)
var VoteKey = []byte("vote")
Functions ¶
func QcFromGenesisState ¶
func QcFromGenesisState(partitionRecords []*genesis.GenesisPartitionRecord) *drctypes.QuorumCert
func ReadLastTC ¶
func ReadLastTC(db keyvaluedb.KeyValueDB) (*abtypes.TimeoutCert, error)
func ReadVote ¶
func ReadVote(db keyvaluedb.KeyValueDB) (any, error)
func ToRecoveryInputData ¶
ToRecoveryInputData function for type conversion
func UnicityCertificatesFromGenesis ¶
func UnicityCertificatesFromGenesis(pg []*genesis.GenesisPartitionRecord) map[types.SystemID]*types.UnicityCertificate
func WriteLastTC ¶
func WriteLastTC(db keyvaluedb.KeyValueDB, tc *abtypes.TimeoutCert) error
func WriteVote ¶
func WriteVote(db keyvaluedb.KeyValueDB, vote any) error
Types ¶
type BlockStore ¶
type BlockStore struct {
// contains filtered or unexported fields
}
func New ¶
func New(hash gocrypto.Hash, pg []*genesis.GenesisPartitionRecord, db keyvaluedb.KeyValueDB) (block *BlockStore, err error)
func NewFromState ¶
func NewFromState(hash gocrypto.Hash, stateMsg *abdrc.StateMsg, db keyvaluedb.KeyValueDB) (*BlockStore, error)
func (*BlockStore) Add ¶
func (x *BlockStore) Add(block *drctypes.BlockData, verifier IRChangeReqVerifier) ([]byte, error)
Add adds new round state to pipeline and returns the new state root hash a.k.a. execStateID
func (*BlockStore) Block ¶
func (x *BlockStore) Block(round uint64) (*ExecutedBlock, error)
Block returns block for given round. When store doesn't have block for the round it returns error.
func (*BlockStore) GetCertificate ¶
func (x *BlockStore) GetCertificate(id types.SystemID) (*types.UnicityCertificate, error)
func (*BlockStore) GetCertificates ¶
func (x *BlockStore) GetCertificates() map[types.SystemID]*types.UnicityCertificate
func (*BlockStore) GetDB ¶
func (x *BlockStore) GetDB() keyvaluedb.KeyValueDB
func (*BlockStore) GetHighQc ¶
func (x *BlockStore) GetHighQc() *drctypes.QuorumCert
func (*BlockStore) GetLastTC ¶
func (x *BlockStore) GetLastTC() (*drctypes.TimeoutCert, error)
func (*BlockStore) GetState ¶
func (x *BlockStore) GetState() *abdrc.StateMsg
func (*BlockStore) IsChangeInProgress ¶
func (x *BlockStore) IsChangeInProgress(sysId types.SystemID) *types.InputRecord
IsChangeInProgress - return input record if sysID has a pending IR change in the pipeline or nil if no change is currently in the pipeline.
func (*BlockStore) ProcessQc ¶
func (x *BlockStore) ProcessQc(qc *drctypes.QuorumCert) (map[types.SystemID]*types.UnicityCertificate, error)
func (*BlockStore) ProcessTc ¶
func (x *BlockStore) ProcessTc(tc *drctypes.TimeoutCert) (rErr error)
func (*BlockStore) ReadLastVote ¶
func (x *BlockStore) ReadLastVote() (any, error)
ReadLastVote returns last sent vote message by this node
func (*BlockStore) StoreLastVote ¶
func (x *BlockStore) StoreLastVote(vote any) error
StoreLastVote stores last sent vote message by this node
type BlockTree ¶
type BlockTree struct {
// contains filtered or unexported fields
}
func NewBlockTree ¶
func NewBlockTree(bDB keyvaluedb.KeyValueDB) (*BlockTree, error)
func NewBlockTreeFromRecovery ¶
func NewBlockTreeFromRecovery(block *ExecutedBlock, bDB keyvaluedb.KeyValueDB) (*BlockTree, error)
func (*BlockTree) Add ¶
func (bt *BlockTree) Add(block *ExecutedBlock) error
Add adds new leaf to the block tree
func (*BlockTree) Commit ¶
func (bt *BlockTree) Commit(commitQc *abdrc.QuorumCert) (execBlock *ExecutedBlock, err error)
Commit commits block for round and prunes all preceding blocks from the tree, the committed block becomes the new root of the tree
func (*BlockTree) FindPathToRoot ¶
func (bt *BlockTree) FindPathToRoot(round uint64) []*ExecutedBlock
FindPathToRoot finds bath from node with round to root node returns nil in case of failure, when a node is not found otherwise it will return list of data stored in the path nodes, excluding the root data itself, so if the root node is previous node then the list is empty
func (*BlockTree) GetAllUncommittedNodes ¶
func (bt *BlockTree) GetAllUncommittedNodes() []*ExecutedBlock
func (*BlockTree) HighQc ¶
func (bt *BlockTree) HighQc() *abdrc.QuorumCert
func (*BlockTree) RemoveLeaf ¶
RemoveLeaf removes leaf node if it is not root node
func (*BlockTree) Root ¶
func (bt *BlockTree) Root() *ExecutedBlock
type ExecutedBlock ¶
type ExecutedBlock struct { BlockData *drctypes.BlockData // proposed block CurrentIR InputRecords // all input records in this block Changed SysIDList // changed partition system identifiers HashAlgo gocrypto.Hash // hash algorithm for the block RootHash []byte // resulting root hash Qc *drctypes.QuorumCert // block's quorum certificate (from next view) CommitQc *drctypes.QuorumCert // block's commit certificate // contains filtered or unexported fields }
func NewExecutedBlock ¶
func NewExecutedBlock(hash gocrypto.Hash, newBlock *drctypes.BlockData, parent *ExecutedBlock, verifier IRChangeReqVerifier) (*ExecutedBlock, error)
func NewGenesisBlock ¶
func NewGenesisBlock(hash gocrypto.Hash, pg []*genesis.GenesisPartitionRecord) *ExecutedBlock
func NewRootBlock ¶
func NewRootBlock(hash gocrypto.Hash, block *abdrc.CommittedBlock) (*ExecutedBlock, error)
func (*ExecutedBlock) GenerateCertificates ¶
func (x *ExecutedBlock) GenerateCertificates(commitQc *drctypes.QuorumCert) (map[types.SystemID]*types.UnicityCertificate, error)
func (*ExecutedBlock) GetParentRound ¶
func (x *ExecutedBlock) GetParentRound() uint64
func (*ExecutedBlock) GetRound ¶
func (x *ExecutedBlock) GetRound() uint64
type IRChangeReqVerifier ¶
type IRChangeReqVerifier interface {
VerifyIRChangeReq(round uint64, irChReq *drctypes.IRChangeReq) (*InputData, error)
}
type InputData ¶
type InputData struct { SysID types.SystemID IR *types.InputRecord Sdrh []byte // System Description Record Hash // contains filtered or unexported fields }
type InputRecords ¶
type InputRecords []*InputData
func (InputRecords) Update ¶
func (data InputRecords) Update(newInputData *InputData) error