Documentation ¶
Index ¶
- func InitAcceptedBlockUpdate(subscriber eventbus.Subscriber) (chan block.Block, uint32)
- func MockMember(keys key.Keys) *user.Member
- func MockProvisioners(amount int) (*user.Provisioners, []key.Keys)
- func MockScoreMsg(t *testing.T, hdr *header.Header) message.Message
- type CandidateVerificationFunc
- type ControlFn
- type Controller
- type Emitter
- type InternalPacket
- type Phase
- type PhaseFn
- type Publisher
- type Queue
- type Results
- type RoundUpdate
- type TestCallback
- type TestPhase
- type Threshold
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitAcceptedBlockUpdate ¶
func InitAcceptedBlockUpdate(subscriber eventbus.Subscriber) (chan block.Block, uint32)
InitAcceptedBlockUpdate init listener to get updates about lastly accepted block in the chain.
func MockMember ¶ added in v0.2.0
MockMember mocks a Provisioner.
func MockProvisioners ¶ added in v0.2.0
func MockProvisioners(amount int) (*user.Provisioners, []key.Keys)
MockProvisioners mock a Provisioner set.
Types ¶
type CandidateVerificationFunc ¶ added in v0.4.0
CandidateVerificationFunc is a callback used to verify candidate blocks after the conclusion of the first reduction step.
type ControlFn ¶ added in v0.4.0
ControlFn represents the asynchronous loop controlling the commencement of the Phase transition.
type Controller ¶ added in v0.4.0
type Controller interface { // GetControlFn returns a ControlFn. GetControlFn() ControlFn }
Controller is a factory for the ControlFn. It basically relates to the Agreement, which needs a different execution each round.
type Emitter ¶ added in v0.4.0
type Emitter struct { EventBus *eventbus.EventBus RPCBus *rpcbus.RPCBus Keys key.Keys Proxy transactions.Proxy TimerLength time.Duration }
Emitter is a simple struct to pass the communication channels that the steps should be able to emit onto.
func MockEmitter ¶ added in v0.4.0
func MockEmitter(consTimeout time.Duration, proxy transactions.Proxy) *Emitter
MockEmitter is a utility to quickly wire up an emitter in tests.
func StupidEmitter ¶ added in v0.4.0
func StupidEmitter() (*Emitter, *user.Provisioners)
StupidEmitter ...
type InternalPacket ¶ added in v0.3.0
InternalPacket is a specialization of the Payload of message.Message. It is used to unify messages used by the consensus, which need to carry the header.Header for consensus specific operations.
type Phase ¶ added in v0.4.0
type Phase interface { // Initialize accepts as an // argument an interface, usually a message or the result of the state // function execution. It provides the capability to create a closure of sort. Initialize(InternalPacket) PhaseFn }
Phase is used whenever an instantiation is needed.
type PhaseFn ¶ added in v0.4.0
type PhaseFn interface { // Run the phase function. Run(context.Context, *Queue, chan message.Message, RoundUpdate, uint8) PhaseFn // String returns the description of this phase function. String() string }
PhaseFn represents the recursive consensus state function.
type Publisher ¶ added in v0.4.0
type Publisher struct {
// contains filtered or unexported fields
}
Publisher is used to direct consensus messages from the peer.MessageProcessor to the consensus components.
func NewPublisher ¶ added in v0.4.0
NewPublisher returns an initialized Publisher.
type Queue ¶ added in v0.2.0
type Queue struct {
// contains filtered or unexported fields
}
Queue is a Queue of Events grouped by rounds and steps. It is thread-safe through a sync.RWMutex. TODO: entries should become buntdb instead.
func NewQueue ¶ added in v0.2.0
func NewQueue() *Queue
NewQueue creates a new Queue. It is primarily used by Collectors to temporarily store messages not yet relevant to the collection process.
func (*Queue) Flush ¶ added in v0.2.0
Flush all events stored for a specific round from the queue, and return them.
type RoundUpdate ¶ added in v0.2.0
type RoundUpdate struct { Round uint64 P user.Provisioners Seed []byte Hash []byte LastCertificate *block.Certificate }
RoundUpdate carries the data about the new Round, such as the active Provisioners, the BidList, the Seed and the Hash.
func MockRoundUpdate ¶ added in v0.2.0
func MockRoundUpdate(round uint64, p *user.Provisioners) RoundUpdate
MockRoundUpdate mocks a round update.
func (RoundUpdate) Copy ¶ added in v0.4.0
func (r RoundUpdate) Copy() payload.Safe
Copy complies with message.Safe interface. It returns a deep copy of the message safe to publish to multiple subscribers.
type TestCallback ¶ added in v0.4.0
type TestCallback func(*require.Assertions, InternalPacket, *eventbus.GossipStreamer)
TestCallback is a callback to allow for table testing based on step results.
type TestPhase ¶ added in v0.4.0
type TestPhase struct {
// contains filtered or unexported fields
}
TestPhase is the phase to inject in the step under test to allow for table testing. It treats the packet injected through the Fn method as the result to test.
func NewTestPhase ¶ added in v0.4.0
func NewTestPhase(t *testing.T, callback TestCallback, streamer *eventbus.GossipStreamer) *TestPhase
NewTestPhase returns a Phase implementation suitable for testing steps.
func (*TestPhase) Initialize ¶ added in v0.4.0
func (t *TestPhase) Initialize(sv InternalPacket) PhaseFn
Initialize is used by the step under test to provide its result.
type Threshold ¶
type Threshold struct {
// contains filtered or unexported fields
}
Threshold is a number which proof scores should be compared against. If a proof score does not exceed the Threshold value, it should be discarded.