Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BackgroundTask ¶ added in v1.24.1
BackgroundTask are tasks that: * Always run in the background * Never finish "successfully" When a node is cordoned (not schedulable), background tasks MUST yield.
func IsBackgroundTask ¶ added in v1.24.1
func SliceIfFound ¶
SubsetIf returns a subset of the slice for which the predicate is true. It does not allocate memory, but rearranges the list in place. A non-zero list input will always return a non-zero list. The return value is the subset and a boolean indicating whether the subset was sliced.
Types ¶
type Limiter ¶ added in v1.24.0
type Limiter interface {
// Active returns the number of tasks of this type that are currently running
// in this limiter / limiter group.
Active() int
// ActiveThis returns the number of tasks of this type that are currently running
// in this limiter (e.g. per-task-type count).
ActiveThis() int
// AtMax returns whether this limiter permits more tasks to run.
AtMax() bool
// Add increments / decrements the active task counters by delta. This call
// is atomic
Add(delta int)
// Instance spawns a sub-instance of this limiter. This is called by harmonytask on startup for each task
// using this limiter. Each sub-instance has it's own individual "This" counter, but can share a common counter.
Instance() Limiter
}
type MaxCounter ¶ added in v1.23.1
type MaxCounter struct {
// maximum number of tasks of this type that can be run
N int
// contains filtered or unexported fields
}
func Max ¶ added in v1.23.1
func Max(n int) *MaxCounter
func (*MaxCounter) Active ¶ added in v1.23.1
func (m *MaxCounter) Active() int
note: cur can't be called on counters for which max is 0
func (*MaxCounter) ActiveThis ¶ added in v1.23.1
func (m *MaxCounter) ActiveThis() int
func (*MaxCounter) Add ¶ added in v1.23.1
func (m *MaxCounter) Add(n int)
func (*MaxCounter) AtMax ¶ added in v1.23.1
func (m *MaxCounter) AtMax() bool
func (*MaxCounter) Instance ¶ added in v1.24.0
func (m *MaxCounter) Instance() Limiter
func (*MaxCounter) Max ¶ added in v1.23.1
func (m *MaxCounter) Max() int
type RetryWaitFunc ¶ added in v1.25.1
func RetryWaitExp ¶ added in v1.25.1
func RetryWaitExp(initial time.Duration, factor float64) RetryWaitFunc
RetryWaitExp returns a function that calculates an exponentially increasing duration based on retries.
func RetryWaitLinear ¶ added in v1.25.1
func RetryWaitLinear(initial, increment time.Duration) RetryWaitFunc
RetryWaitLinear returns a function that calculates a linearly increasing duration based on retries.