Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EstimateETA ¶
EstimateETA attempts to estimate the remaining time for a job to finish given the [startTime] and it's current progress.
func ProgressFromHash ¶ added in v1.10.4
ProgressFromHash returns the progress out of MaxUint64 assuming [b] is a key in a uniformly distributed sequence that is being iterated lexicographically.
Types ¶
type AdaptiveTimeoutConfig ¶
type AdaptiveTimeoutConfig struct { InitialTimeout time.Duration `json:"initialTimeout"` MinimumTimeout time.Duration `json:"minimumTimeout"` MaximumTimeout time.Duration `json:"maximumTimeout"` // Timeout is [timeoutCoefficient] * average response time // [timeoutCoefficient] must be > 1 TimeoutCoefficient float64 `json:"timeoutCoefficient"` // Larger halflife --> less volatile timeout // [timeoutHalfLife] must be positive TimeoutHalflife time.Duration `json:"timeoutHalflife"` }
AdaptiveTimeoutConfig contains the parameters provided to the adaptive timeout manager.
type AdaptiveTimeoutManager ¶
type AdaptiveTimeoutManager interface { // Start the timeout manager. // Must be called before any other method. // Must only be called once. Dispatch() // Stop the timeout manager. // Must only be called once. Stop() // Returns the current network timeout duration. TimeoutDuration() time.Duration // Registers a timeout for the item with the given [id]. // If the timeout occurs before the item is Removed, [timeoutHandler] is called. Put(id ids.RequestID, measureLatency bool, timeoutHandler func()) // Remove the timeout associated with [id]. // Its timeout handler will not be called. Remove(id ids.RequestID) // ObserveLatency manually registers a response latency. // We use this to pretend that it a query to a benched validator // timed out when actually, we never even sent them a request. ObserveLatency(latency time.Duration) }
func NewAdaptiveTimeoutManager ¶ added in v1.8.4
func NewAdaptiveTimeoutManager( config *AdaptiveTimeoutConfig, metricsNamespace string, metricsRegister prometheus.Registerer, ) (AdaptiveTimeoutManager, error)
type Meter ¶
type Meter interface { // Notify this meter of a new event for it to rate Tick() // Return the number of events this meter is currently tracking Ticks() int }
Meter tracks the number of occurrences of a specified event
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
Timer wraps a timer object. This allows a user to specify a handler. Once specifying the handler, the dispatch thread can be called. The dispatcher will only return after calling Stop. SetTimeoutIn will result in calling the handler in the specified amount of time.
func (*Timer) SetTimeoutIn ¶
SetTimeoutIn will set the timer to fire the handler in [duration]