Documentation ¶
Index ¶
- Variables
- type AdaptiveTimeoutConfig
- type AdaptiveTimeoutManager
- func (tm *AdaptiveTimeoutManager) Dispatch()
- func (tm *AdaptiveTimeoutManager) Initialize(config *AdaptiveTimeoutConfig) error
- func (tm *AdaptiveTimeoutManager) Put(id ids.ID, handler func()) time.Time
- func (tm *AdaptiveTimeoutManager) Remove(id ids.ID)
- func (tm *AdaptiveTimeoutManager) Stop()
- func (tm *AdaptiveTimeoutManager) Timeout()
- type Clock
- type Executor
- type Meter
- type Repeater
- type TimedMeter
- type TimeoutManager
- type Timer
Constants ¶
This section is empty.
Variables ¶
var ( MillisecondsBuckets = []float64{ 10, 100, 250, 500, 1000, 1500, 2000, 3000, 5000, 10000, } NanosecondsBuckets = []float64{ float64(100 * time.Nanosecond), float64(time.Microsecond), float64(10 * time.Microsecond), float64(100 * time.Microsecond), float64(time.Millisecond), float64(10 * time.Millisecond), float64(100 * time.Millisecond), float64(time.Second), } )
Useful latency buckets
var ( // MaxTime was taken from https://stackoverflow.com/questions/25065055/what-is-the-maximum-time-time-in-go/32620397#32620397 MaxTime = time.Unix(1<<63-62135596801, 0) // 0 is used because we drop the nano-seconds )
Functions ¶
This section is empty.
Types ¶
type AdaptiveTimeoutConfig ¶ added in v0.8.0
type AdaptiveTimeoutConfig struct { InitialTimeout time.Duration MinimumTimeout time.Duration MaximumTimeout time.Duration TimeoutInc time.Duration TimeoutDec time.Duration Namespace string Registerer prometheus.Registerer }
AdaptiveTimeoutConfig contains the parameters that should be provided to the adaptive timeout manager.
type AdaptiveTimeoutManager ¶ added in v0.8.0
type AdaptiveTimeoutManager struct {
// contains filtered or unexported fields
}
AdaptiveTimeoutManager is a manager for timeouts.
func (*AdaptiveTimeoutManager) Dispatch ¶ added in v0.8.0
func (tm *AdaptiveTimeoutManager) Dispatch()
Dispatch ...
func (*AdaptiveTimeoutManager) Initialize ¶ added in v0.8.0
func (tm *AdaptiveTimeoutManager) Initialize(config *AdaptiveTimeoutConfig) error
Initialize this timeout manager with the provided config
func (*AdaptiveTimeoutManager) Put ¶ added in v0.8.0
func (tm *AdaptiveTimeoutManager) Put(id ids.ID, handler func()) time.Time
Put puts hash into the hash map
func (*AdaptiveTimeoutManager) Remove ¶ added in v0.8.0
func (tm *AdaptiveTimeoutManager) Remove(id ids.ID)
Remove the item that no longer needs to be there.
func (*AdaptiveTimeoutManager) Stop ¶ added in v0.8.0
func (tm *AdaptiveTimeoutManager) Stop()
Stop executing timeouts
func (*AdaptiveTimeoutManager) Timeout ¶ added in v0.8.0
func (tm *AdaptiveTimeoutManager) Timeout()
Timeout registers a timeout
type Clock ¶
type Clock struct {
// contains filtered or unexported fields
}
Clock acts as a thin wrapper around global time that allows for easy testing
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor ...
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 Repeater ¶
type Repeater struct {
// contains filtered or unexported fields
}
Repeater ...
func NewRepeater ¶
NewRepeater ...
type TimedMeter ¶
type TimedMeter struct { // Amount of time to keep a tick Duration time.Duration // contains filtered or unexported fields }
TimedMeter is a meter that discards old events
type TimeoutManager ¶
type TimeoutManager struct {
// contains filtered or unexported fields
}
TimeoutManager is a manager for timeouts.
func (*TimeoutManager) Initialize ¶
func (tm *TimeoutManager) Initialize(duration time.Duration)
Initialize is a constructor b/c Golang, in its wisdom, doesn't ... have them?
func (*TimeoutManager) Put ¶
func (tm *TimeoutManager) Put(id ids.ID, handler func())
Put puts hash into the hash map
func (*TimeoutManager) Remove ¶
func (tm *TimeoutManager) Remove(id ids.ID)
Remove the item that no longer needs to be there.
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]