Documentation ¶
Index ¶
- Constants
- type Node
- func (node *Node) BuildConfig(logger interfaces.Logger) *interfaces.Config
- func (node *Node) GetBlockProofAt(height primitives.BlockHeight) []byte
- func (node *Node) GetKeyManager() interfaces.KeyManager
- func (node *Node) GetLatestBlock() interfaces.Block
- func (node *Node) GetLatestBlockProof() []byte
- func (node *Node) GetMemberId() primitives.MemberId
- func (node *Node) StartConsensus(ctx context.Context)
- func (node *Node) StartConsensusSync(ctx context.Context)
- func (node *Node) Sync(ctx context.Context, prevBlock interfaces.Block, blockProofBytes []byte, ...)
- func (node *Node) TriggerElection(ctx context.Context)
- func (node *Node) ValidateBlockConsensus(ctx context.Context, block interfaces.Block, blockProof []byte, ...) error
- type NodeBuilder
- func (builder *NodeBuilder) AsInstanceId(instanceId primitives.InstanceId) *NodeBuilder
- func (builder *NodeBuilder) Build() *Node
- func (builder *NodeBuilder) CommunicatesVia(communication *mocks.CommunicationMock) *NodeBuilder
- func (builder *NodeBuilder) ThatIsPartOf(membership interfaces.Membership) *NodeBuilder
- func (builder *NodeBuilder) ThatLogsToConsole() *NodeBuilder
- func (builder *NodeBuilder) WithBlocksPool(blocksPool *mocks.BlocksPool) *NodeBuilder
- func (builder *NodeBuilder) WithElectionTrigger(electionTrigger interfaces.ElectionTrigger) *NodeBuilder
- func (builder *NodeBuilder) WithMemberId(memberId primitives.MemberId) *NodeBuilder
- type NodeState
- type TestNetwork
- func (net *TestNetwork) AllNodesChainEndsWithABlock(block interfaces.Block) bool
- func (net *TestNetwork) AllNodesValidatedNoMoreThanOnceBeforeCommit(ctx context.Context) bool
- func (net *TestNetwork) GetNodeCommunication(memberId primitives.MemberId) *mocks.CommunicationMock
- func (net *TestNetwork) NodesPauseOnValidate(nodes ...*Node)
- func (net *TestNetwork) RegisterNode(node *Node)
- func (net *TestNetwork) RegisterNodes(nodes []*Node)
- func (net *TestNetwork) ResumeNodeRequestNewBlock(ctx context.Context, node *Node)
- func (net *TestNetwork) ResumeNodesValidation(ctx context.Context, nodes ...*Node)
- func (net *TestNetwork) SetNodesToPauseOnRequestNewBlock(nodes ...*Node)
- func (net *TestNetwork) StartConsensus(ctx context.Context) *TestNetwork
- func (net *TestNetwork) StartConsensusSync(ctx context.Context) *TestNetwork
- func (net *TestNetwork) TriggerElection(ctx context.Context)
- func (net *TestNetwork) WaitForAllNodesToCommitBlock(ctx context.Context, block interfaces.Block) bool
- func (net *TestNetwork) WaitForAllNodesToCommitTheSameBlock(ctx context.Context) bool
- func (net *TestNetwork) WaitForConsensus(ctx context.Context)
- func (net *TestNetwork) WaitForNodeToRequestNewBlock(ctx context.Context, node *Node)
- func (net *TestNetwork) WaitForNodesToCommitABlock(ctx context.Context, nodes ...*Node)
- func (net *TestNetwork) WaitForNodesToCommitASpecificBlock(ctx context.Context, block interfaces.Block, nodes ...*Node) bool
- func (net *TestNetwork) WaitForNodesToValidate(ctx context.Context, nodes ...*Node)
- type TestNetworkBuilder
- func (tb *TestNetworkBuilder) Build() *TestNetwork
- func (tb *TestNetworkBuilder) GossipMessagesMaxDelay(duration time.Duration) *TestNetworkBuilder
- func (builder *TestNetworkBuilder) InNetwork(instanceId primitives.InstanceId) *TestNetworkBuilder
- func (tb *TestNetworkBuilder) LogToConsole() *TestNetworkBuilder
- func (tb *TestNetworkBuilder) OrderCommitteeByHeight() *TestNetworkBuilder
- func (tb *TestNetworkBuilder) WithBlockUtils(utils interfaces.BlockUtils) *TestNetworkBuilder
- func (tb *TestNetworkBuilder) WithBlocks(upcomingBlocks []interfaces.Block) *TestNetworkBuilder
- func (tb *TestNetworkBuilder) WithCommunication(communication interfaces.Communication) *TestNetworkBuilder
- func (tb *TestNetworkBuilder) WithCustomNodeBuilder(nodeBuilder *NodeBuilder) *TestNetworkBuilder
- func (tb *TestNetworkBuilder) WithKeyManager(mgr interfaces.KeyManager) *TestNetworkBuilder
- func (tb *TestNetworkBuilder) WithNodeCount(nodeCount int) *TestNetworkBuilder
- func (tb *TestNetworkBuilder) WithTimeBasedElectionTrigger(timeout time.Duration) *TestNetworkBuilder
Constants ¶
View Source
const MINIMUM_NUMBER_OF_NODES_FOR_CONSENSUS = 4
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct { ElectionTrigger interfaces.ElectionTrigger BlockUtils *mocks.MockBlockUtils KeyManager *mocks.MockKeyManager Storage interfaces.Storage Communication *mocks.CommunicationMock Membership interfaces.Membership MemberId primitives.MemberId NodeStateChannel chan *NodeState WriteToStateChannel bool // contains filtered or unexported fields }
func ADummyNode ¶
func ADummyNode() *Node
func NewNode ¶
func NewNode( instanceId primitives.InstanceId, membership interfaces.Membership, communication *mocks.CommunicationMock, blockUtils *mocks.MockBlockUtils, electionTrigger interfaces.ElectionTrigger, logger interfaces.Logger) *Node
func (*Node) BuildConfig ¶
func (node *Node) BuildConfig(logger interfaces.Logger) *interfaces.Config
func (*Node) GetBlockProofAt ¶
func (node *Node) GetBlockProofAt(height primitives.BlockHeight) []byte
func (*Node) GetKeyManager ¶
func (node *Node) GetKeyManager() interfaces.KeyManager
func (*Node) GetLatestBlock ¶
func (node *Node) GetLatestBlock() interfaces.Block
func (*Node) GetLatestBlockProof ¶
func (*Node) GetMemberId ¶
func (node *Node) GetMemberId() primitives.MemberId
func (*Node) StartConsensus ¶
func (*Node) StartConsensusSync ¶
func (*Node) TriggerElection ¶
func (*Node) ValidateBlockConsensus ¶
type NodeBuilder ¶
type NodeBuilder struct {
// contains filtered or unexported fields
}
func NewNodeBuilder ¶
func NewNodeBuilder() *NodeBuilder
func (*NodeBuilder) AsInstanceId ¶
func (builder *NodeBuilder) AsInstanceId(instanceId primitives.InstanceId) *NodeBuilder
func (*NodeBuilder) Build ¶
func (builder *NodeBuilder) Build() *Node
func (*NodeBuilder) CommunicatesVia ¶
func (builder *NodeBuilder) CommunicatesVia(communication *mocks.CommunicationMock) *NodeBuilder
func (*NodeBuilder) ThatIsPartOf ¶
func (builder *NodeBuilder) ThatIsPartOf(membership interfaces.Membership) *NodeBuilder
func (*NodeBuilder) ThatLogsToConsole ¶
func (builder *NodeBuilder) ThatLogsToConsole() *NodeBuilder
func (*NodeBuilder) WithBlocksPool ¶
func (builder *NodeBuilder) WithBlocksPool(blocksPool *mocks.BlocksPool) *NodeBuilder
func (*NodeBuilder) WithElectionTrigger ¶
func (builder *NodeBuilder) WithElectionTrigger(electionTrigger interfaces.ElectionTrigger) *NodeBuilder
func (*NodeBuilder) WithMemberId ¶
func (builder *NodeBuilder) WithMemberId(memberId primitives.MemberId) *NodeBuilder
type TestNetwork ¶
type TestNetwork struct { InstanceId primitives.InstanceId Nodes []*Node Discovery *mocks.Discovery }
func ABasicTestNetwork ¶
func ABasicTestNetwork() *TestNetwork
func ATestNetwork ¶
func ATestNetwork(countOfNodes int, blocksPool ...interfaces.Block) *TestNetwork
func NewTestNetwork ¶
func NewTestNetwork(instanceId primitives.InstanceId, discovery *mocks.Discovery) *TestNetwork
func (*TestNetwork) AllNodesChainEndsWithABlock ¶
func (net *TestNetwork) AllNodesChainEndsWithABlock(block interfaces.Block) bool
func (*TestNetwork) AllNodesValidatedNoMoreThanOnceBeforeCommit ¶
func (net *TestNetwork) AllNodesValidatedNoMoreThanOnceBeforeCommit(ctx context.Context) bool
func (*TestNetwork) GetNodeCommunication ¶
func (net *TestNetwork) GetNodeCommunication(memberId primitives.MemberId) *mocks.CommunicationMock
func (*TestNetwork) NodesPauseOnValidate ¶
func (net *TestNetwork) NodesPauseOnValidate(nodes ...*Node)
func (*TestNetwork) RegisterNode ¶
func (net *TestNetwork) RegisterNode(node *Node)
func (*TestNetwork) RegisterNodes ¶
func (net *TestNetwork) RegisterNodes(nodes []*Node)
func (*TestNetwork) ResumeNodeRequestNewBlock ¶
func (net *TestNetwork) ResumeNodeRequestNewBlock(ctx context.Context, node *Node)
func (*TestNetwork) ResumeNodesValidation ¶
func (net *TestNetwork) ResumeNodesValidation(ctx context.Context, nodes ...*Node)
func (*TestNetwork) SetNodesToPauseOnRequestNewBlock ¶
func (net *TestNetwork) SetNodesToPauseOnRequestNewBlock(nodes ...*Node)
func (*TestNetwork) StartConsensus ¶
func (net *TestNetwork) StartConsensus(ctx context.Context) *TestNetwork
func (*TestNetwork) StartConsensusSync ¶
func (net *TestNetwork) StartConsensusSync(ctx context.Context) *TestNetwork
func (*TestNetwork) TriggerElection ¶
func (net *TestNetwork) TriggerElection(ctx context.Context)
func (*TestNetwork) WaitForAllNodesToCommitBlock ¶
func (net *TestNetwork) WaitForAllNodesToCommitBlock(ctx context.Context, block interfaces.Block) bool
func (*TestNetwork) WaitForAllNodesToCommitTheSameBlock ¶
func (net *TestNetwork) WaitForAllNodesToCommitTheSameBlock(ctx context.Context) bool
func (*TestNetwork) WaitForConsensus ¶
func (net *TestNetwork) WaitForConsensus(ctx context.Context)
func (*TestNetwork) WaitForNodeToRequestNewBlock ¶
func (net *TestNetwork) WaitForNodeToRequestNewBlock(ctx context.Context, node *Node)
func (*TestNetwork) WaitForNodesToCommitABlock ¶
func (net *TestNetwork) WaitForNodesToCommitABlock(ctx context.Context, nodes ...*Node)
func (*TestNetwork) WaitForNodesToCommitASpecificBlock ¶
func (net *TestNetwork) WaitForNodesToCommitASpecificBlock(ctx context.Context, block interfaces.Block, nodes ...*Node) bool
func (*TestNetwork) WaitForNodesToValidate ¶
func (net *TestNetwork) WaitForNodesToValidate(ctx context.Context, nodes ...*Node)
type TestNetworkBuilder ¶
type TestNetworkBuilder struct { NodeCount int // contains filtered or unexported fields }
func NewTestNetworkBuilder ¶
func NewTestNetworkBuilder() *TestNetworkBuilder
func (*TestNetworkBuilder) Build ¶
func (tb *TestNetworkBuilder) Build() *TestNetwork
func (*TestNetworkBuilder) GossipMessagesMaxDelay ¶
func (tb *TestNetworkBuilder) GossipMessagesMaxDelay(duration time.Duration) *TestNetworkBuilder
func (*TestNetworkBuilder) InNetwork ¶
func (builder *TestNetworkBuilder) InNetwork(instanceId primitives.InstanceId) *TestNetworkBuilder
func (*TestNetworkBuilder) LogToConsole ¶
func (tb *TestNetworkBuilder) LogToConsole() *TestNetworkBuilder
func (*TestNetworkBuilder) OrderCommitteeByHeight ¶
func (tb *TestNetworkBuilder) OrderCommitteeByHeight() *TestNetworkBuilder
func (*TestNetworkBuilder) WithBlockUtils ¶
func (tb *TestNetworkBuilder) WithBlockUtils(utils interfaces.BlockUtils) *TestNetworkBuilder
func (*TestNetworkBuilder) WithBlocks ¶
func (tb *TestNetworkBuilder) WithBlocks(upcomingBlocks []interfaces.Block) *TestNetworkBuilder
func (*TestNetworkBuilder) WithCommunication ¶
func (tb *TestNetworkBuilder) WithCommunication(communication interfaces.Communication) *TestNetworkBuilder
func (*TestNetworkBuilder) WithCustomNodeBuilder ¶
func (tb *TestNetworkBuilder) WithCustomNodeBuilder(nodeBuilder *NodeBuilder) *TestNetworkBuilder
func (*TestNetworkBuilder) WithKeyManager ¶
func (tb *TestNetworkBuilder) WithKeyManager(mgr interfaces.KeyManager) *TestNetworkBuilder
func (*TestNetworkBuilder) WithNodeCount ¶
func (tb *TestNetworkBuilder) WithNodeCount(nodeCount int) *TestNetworkBuilder
func (*TestNetworkBuilder) WithTimeBasedElectionTrigger ¶
func (tb *TestNetworkBuilder) WithTimeBasedElectionTrigger(timeout time.Duration) *TestNetworkBuilder
Click to show internal directories.
Click to hide internal directories.