Documentation
¶
Index ¶
- Constants
- type LinearTimer
- func (t *LinearTimer) DurationAtHeightAndRound(height process.Height, round process.Round) time.Duration
- func (t *LinearTimer) TimeoutPrecommit(height process.Height, round process.Round)
- func (t *LinearTimer) TimeoutPrevote(height process.Height, round process.Round)
- func (t *LinearTimer) TimeoutPropose(height process.Height, round process.Round)
- type Options
- type Timeout
Constants ¶
const ( // DefaultTimeout is the timeout in seconds set by default DefaultTimeout = 20 * time.Second // DefaultTimeoutScaling is the timeout scaling factor set by default DefaultTimeoutScaling = 0.5 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LinearTimer ¶
type LinearTimer struct {
// contains filtered or unexported fields
}
LinearTimer defines a timer that implements a timing out functionality. The timeouts for different contexts (Propose, Prevote and Precommit) are provided as callback functions that handle the corresponding timeouts. The timeout scales linearly with the consensus round
func NewLinearTimer ¶
func NewLinearTimer(opts Options, handleTimeoutPropose, handleTimeoutPrevote, handleTimeoutPrecommit func(Timeout)) *LinearTimer
NewLinearTimer constructs a new Linear Timer from the input options and channels
func (*LinearTimer) DurationAtHeightAndRound ¶ added in v0.4.4
func (t *LinearTimer) DurationAtHeightAndRound(height process.Height, round process.Round) time.Duration
DurationAtHeightAndRound returns the duration of the timeout at the given height and round. This is the duration that the other methods will wait before scheduling their respective timeout events.
func (*LinearTimer) TimeoutPrecommit ¶
func (t *LinearTimer) TimeoutPrecommit(height process.Height, round process.Round)
TimeoutPrecommit schedules a precommit timeout with a timeout period appropriately calculated for the consensus height and round
func (*LinearTimer) TimeoutPrevote ¶
func (t *LinearTimer) TimeoutPrevote(height process.Height, round process.Round)
TimeoutPrevote schedules a prevote timeout with a timeout period appropriately calculated for the consensus height and round
func (*LinearTimer) TimeoutPropose ¶
func (t *LinearTimer) TimeoutPropose(height process.Height, round process.Round)
TimeoutPropose schedules a propose timeout with a timeout period appropriately calculated for the consensus height and round
type Options ¶
Options represent the options for a Linear Timer
func DefaultOptions ¶
func DefaultOptions() Options
DefaultOptions returns the default options for a Linear Timer
func (Options) WithLogger ¶ added in v0.4.1
WithLogger updates the logger used in the Linear Timer
func (Options) WithTimeout ¶
WithTimeout updates the timeout of the Linear Timer
func (Options) WithTimeoutScaling ¶
WithTimeoutScaling updates the timeout scaling factor of the Linear Timer