Documentation ¶
Index ¶
- Variables
- type Manager
- type Round
- func (r *Round) AddCertificate(ctx context.Context, msg rebro.Message) error
- func (r *Round) AddSignature(ctx context.Context, id rebro.MessageID, sig crypto.Signature) error
- func (r *Round) DeleteCertificate(ctx context.Context, id rebro.MessageID) error
- func (r *Round) Finalize(ctx context.Context) error
- func (r *Round) GetCertificate(ctx context.Context, id rebro.MessageID) (rebro.Certificate, error)
- func (r *Round) RoundNumber() uint64
- func (r *Round) Stop(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
var ErrClosedRound = errors.New("closed round access")
ErrClosedRound singles that Round is accessed after being closed
var ErrElapsedRound = errors.New("elapsed round")
ErrElapsedRound is thrown when a requested height was already provided to Manager.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager registers and manages lifecycles for every new Round. It also provides a simple subscription mechanism in Manager.GetRound operations which are fulfilled with Manager.StartRound.
func (*Manager) GetRound ¶
GetRound gets Round from local map by the number or subscribes for the Round to come, if not found.
func (*Manager) StartRound ¶
StartRound instantiates and starts a new Round. It adds the Round to the Manager, notifying all the Manager.GetRound waiters.
func (*Manager) Stop ¶
Stop performs Round.Finalize and Round.Stop on all the registered instances of Round and then terminates. This ensures we retain in-progress Round state.
type Round ¶
type Round struct {
// contains filtered or unexported fields
}
Round maintains state of broadcasting rounds and local pubsub system for certificates. It guards rebro.QuorumCertificate from concurrent access ensuring thread-safety. Round is not concerned of validity of any given input and solely acting as a state machine of the broadcasting round.
func NewRound ¶
func NewRound(roundNum uint64, quorum rebro.QuorumCertificate) *Round
NewRound instantiates a new Round state machine wrapping rebro.QuorumCertificate. This passes full ownership of the rebro.QuorumCertificate fully to Round, thus it must not be used for writes until Round has been stopped.
func (*Round) AddCertificate ¶
AddCertificate add the given message to the Round forming a new rebro.Certificate on rebro.QuorumCertificate.
func (*Round) AddSignature ¶
AddSignature appends a Signature to one of the Round's Certificates.
func (*Round) DeleteCertificate ¶
DeleteCertificate deletes certificate from the Round by the associated rebro.MessageID.
func (*Round) Finalize ¶
Finalize awaits finalization of the Round's rebro.QuorumCertificate.
func (*Round) GetCertificate ¶
GetCertificate gets certificate from the Round by the associated rebro.MessageID.
func (*Round) RoundNumber ¶
RoundNumber provides number of the Round.