 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultConfig = NewDefaultConfig()
    Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
	// MinReplicaTimeout is the minimum the timeout can decrease to [MILLISECONDS]
	MinReplicaTimeout float64
	// MaxReplicaTimeout is the maximum value the timeout can increase to [MILLISECONDS]
	MaxReplicaTimeout float64
	// TimeoutAdjustmentFactor: MULTIPLICATIVE factor for increasing timeout when view
	// change was triggered by a TC (unhappy path) or decreasing the timeout on progress
	TimeoutAdjustmentFactor float64
	// HappyPathMaxRoundFailures is the number of rounds without progress where we still consider being
	// on hot path of execution. After exceeding this value we will start increasing timeout values.
	HappyPathMaxRoundFailures uint64
	// BlockRateDelayMS is a delay to broadcast the proposal in order to control block production rate [MILLISECONDS]
	BlockRateDelayMS *atomic.Float64
	// MaxTimeoutObjectRebroadcastInterval is the maximum value for timeout object rebroadcast interval [MILLISECONDS]
	MaxTimeoutObjectRebroadcastInterval float64
}
    Config contains the configuration parameters for a Truncated Exponential Backoff, as implemented by the `timeout.Controller`
- On timeout: increase timeout by multiplicative factor `TimeoutAdjustmentFactor`. This results in exponentially growing timeout duration on multiple subsequent timeouts.
- On progress: decrease timeout by multiplicative factor `TimeoutAdjustmentFactor.
func NewConfig ¶
func NewConfig( minReplicaTimeout time.Duration, maxReplicaTimeout time.Duration, timeoutAdjustmentFactor float64, happyPathMaxRoundFailures uint64, blockRateDelay time.Duration, maxRebroadcastInterval time.Duration, ) (Config, error)
NewConfig creates a new TimoutConfig.
- minReplicaTimeout: minimal timeout value for replica round [Milliseconds] Consistency requirement: must be non-negative
- maxReplicaTimeout: maximal timeout value for replica round [Milliseconds] Consistency requirement: must be non-negative and cannot be smaller than minReplicaTimeout
- timeoutAdjustmentFactor: multiplicative factor for adjusting timeout duration Consistency requirement: must be strictly larger than 1
- happyPathMaxRoundFailures: number of successive failed rounds after which we will start increasing timeouts
- blockRateDelay: a delay to delay the proposal broadcasting [Milliseconds] Consistency requirement: must be non-negative
Returns `model.ConfigurationError` is any of the consistency requirements is violated.
func NewDefaultConfig ¶
func NewDefaultConfig() Config
NewDefaultConfig returns a default timeout configuration. We explicitly provide a method here, which demonstrates in-code how to compute standard values from some basic quantities.
func (*Config) GetBlockRateDelay ¶ added in v0.28.13
GetBlockRateDelay returns the block rate delay as a Duration. This is used by the dyamic config manager.
type Controller ¶
type Controller struct {
	// contains filtered or unexported fields
}
    Controller implements the following truncated exponential backoff:
duration = t_min * min(b ^ ((r-k) * θ(r-k)), t_max)
For practical purpose we will transform this formula into:
duration(r) = t_min * b ^ (min((r-k) * θ(r-k)), c), where c = log_b (t_max / t_min).
In described formula:
  k - is number of rounds we expect during hot path, after failing this many rounds,
      we will start increasing timeouts.
  b - timeout increase factor
  r - failed rounds counter
  θ - Heaviside step function
	 t_min/t_max - minimum/maximum round duration
By manipulating `r` after observing progress or lack thereof, we are achieving exponential increase/decrease of round durations.
- on timeout: increase number of failed rounds, this results in exponential growing round duration on multiple subsequent timeouts, after exceeding k.
- on progress: decrease number of failed rounds, this results in exponential decrease of round duration.
func NewController ¶
func NewController(timeoutConfig Config) *Controller
NewController creates a new Controller.
func (*Controller) BlockRateDelay ¶
func (t *Controller) BlockRateDelay() time.Duration
BlockRateDelay is a delay to broadcast the proposal in order to control block production rate
func (*Controller) Channel ¶
func (t *Controller) Channel() <-chan time.Time
Channel returns a channel that will receive the specific timeout. A new channel is created on each call of `StartTimeout`. Returns closed channel if no timer has been started.
func (*Controller) OnProgressBeforeTimeout ¶
func (t *Controller) OnProgressBeforeTimeout()
OnProgressBeforeTimeout indicates to the Controller that progress was made _before_ the timeout was reached
func (*Controller) OnTimeout ¶
func (t *Controller) OnTimeout()
OnTimeout indicates to the Controller that a view change was triggered by a TC (unhappy path).
func (*Controller) StartTimeout ¶
StartTimeout starts the timeout of the specified type and returns the timer info