Documentation ¶
Index ¶
- Variables
- func AbsInt(a int) int
- func DurationMinusBuffer(intv time.Duration, buffer time.Duration, jitter int64) time.Duration
- func DurationMinusBufferDomain(intv time.Duration, buffer time.Duration, jitter int64) (min time.Duration, max time.Duration)
- func MaxInt(a, b int) int
- func MinInt(a, b int) int
- func RandomStagger(intv time.Duration) time.Duration
- func RateScaledInterval(rate float64, min time.Duration, n int) time.Duration
- func SeedMathRand()
- func StrContains(l []string, s string) bool
Constants ¶
This section is empty.
Variables ¶
var ( // SeededSecurely is set to true if a cryptographically secure seed // was used to initialize rand. When false, the start time is used // as a seed. SeededSecurely bool )
Functions ¶
func DurationMinusBuffer ¶ added in v0.7.0
DurationMinusBuffer returns a duration, minus a buffer and jitter subtracted from the duration. This function is used primarily for servicing Consul TTL Checks in advance of the TTL.
func DurationMinusBufferDomain ¶ added in v0.7.0
func DurationMinusBufferDomain(intv time.Duration, buffer time.Duration, jitter int64) (min time.Duration, max time.Duration)
DurationMinusBufferDomain returns the domain of valid durations from a call to DurationMinusBuffer. This function is used to check user specified input values to DurationMinusBuffer.
func RandomStagger ¶
Returns a random stagger interval between 0 and the duration
func RateScaledInterval ¶
RateScaledInterval is used to choose an interval to perform an action in order to target an aggregate number of actions per second across the whole cluster.
func SeedMathRand ¶
func SeedMathRand()
SeedMathRand provides weak, but guaranteed seeding, which is better than running with Go's default seed of 1. A call to SeedMathRand() is expected to be called via init(), but never a second time.
func StrContains ¶
StrContains checks if a list contains a string
Types ¶
This section is empty.