Documentation ¶
Index ¶
- type Factory
- type Handler
- type Helper
- type ScoreHandler
- type Selector
- func (s *Selector) CollectGeneration(packet consensus.InternalPacket) error
- func (s *Selector) CollectScoreEvent(packet consensus.InternalPacket) error
- func (s *Selector) Finalize()
- func (s *Selector) ID() uint32
- func (s *Selector) IncreaseTimeOut()
- func (s *Selector) Initialize(eventPlayer consensus.EventPlayer, signer consensus.Signer, ...) []consensus.TopicListener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Factory ¶ added in v0.2.0
Factory creates the selection component.
func NewFactory ¶ added in v0.2.0
NewFactory instantiates a Factory.
func (*Factory) Instantiate ¶ added in v0.2.0
Instantiate a Selector and return it. Implements consensus.ComponentFactory.
type Handler ¶ added in v0.2.0
type Handler interface { Verify(message.Score) error ResetThreshold() LowerThreshold() Priority(message.Score, message.Score) bool }
Handler is an abstraction of the selection component event handler. It is primarily used for testing purposes, to bypass the zkproof verification.
type Helper ¶ added in v0.2.0
type Helper struct { *Factory BidList user.BidList Selector *Selector *consensus.SimplePlayer BestScoreChan chan message.Message // contains filtered or unexported fields }
Helper for reducing selection test boilerplate
func (*Helper) Initialize ¶ added in v0.2.0
func (h *Helper) Initialize(ru consensus.RoundUpdate)
Initialize the selector with the given round update.
func (*Helper) SendBatch ¶ added in v0.2.0
SendBatch generates a batch of score events and sends them to the selector.
func (*Helper) SetHandler ¶ added in v0.2.0
SetHandler sets the handler on the Selector. Used for bypassing zkproof verification calls during tests.
func (*Helper) StartSelection ¶ added in v0.2.0
func (h *Helper) StartSelection()
StartSelection forces the Selector to start the selection
type ScoreHandler ¶ added in v0.2.0
type ScoreHandler struct {
// contains filtered or unexported fields
}
ScoreHandler manages the score threshold, performs verification of message.Score, keeps tab of the highest score so far
func NewScoreHandler ¶ added in v0.2.0
func NewScoreHandler(bidList user.BidList) *ScoreHandler
NewScoreHandler returns a new instance if ScoreHandler
func (*ScoreHandler) LowerThreshold ¶ added in v0.2.0
func (sh *ScoreHandler) LowerThreshold()
LowerThreshold lowers the threshold after a timespan when no BlockGenerator could send a valid score
func (*ScoreHandler) Priority ¶ added in v0.2.0
func (sh *ScoreHandler) Priority(first, second message.Score) bool
Priority returns true if the first element has priority over the second, false otherwise
func (*ScoreHandler) ResetThreshold ¶ added in v0.2.0
func (sh *ScoreHandler) ResetThreshold()
ResetThreshold resets the score threshold that sets the absolute minimum for a score to be eligible for sending
type Selector ¶ added in v0.2.0
type Selector struct {
// contains filtered or unexported fields
}
Selector is the component responsible for collecting score events and propagating the best one after a timeout.
func NewComponent ¶ added in v0.2.0
NewComponent creates and launches the component which responsibility is to validate and select the best score among the blind bidders. The component publishes under the topic BestScoreTopic
func (*Selector) CollectGeneration ¶ added in v0.2.0
func (s *Selector) CollectGeneration(packet consensus.InternalPacket) error
CollectGeneration signals the selection start by triggering `EventPlayer.Play`
func (*Selector) CollectScoreEvent ¶ added in v0.2.0
func (s *Selector) CollectScoreEvent(packet consensus.InternalPacket) error
CollectScoreEvent checks the score of an incoming Event and, in case it has a higher score, verifies, propagates and saves it
func (*Selector) Finalize ¶ added in v0.2.0
func (s *Selector) Finalize()
Finalize pauses event streaming and stops the timer. Implements consensus.Component.
func (*Selector) ID ¶ added in v0.2.0
ID returns the ID of the Score message Listener. Implements consensus.Component
func (*Selector) IncreaseTimeOut ¶ added in v0.2.0
func (s *Selector) IncreaseTimeOut()
IncreaseTimeOut increases the timeout after a failed selection
func (*Selector) Initialize ¶ added in v0.2.0
func (s *Selector) Initialize(eventPlayer consensus.EventPlayer, signer consensus.Signer, r consensus.RoundUpdate) []consensus.TopicListener
Initialize the Selector, by creating the handler and returning the needed Listeners. Implements consensus.Component.