apiserver: k8s.io/apiserver/pkg/util/flowcontrol/counter Index | Files

package counter

import "k8s.io/apiserver/pkg/util/flowcontrol/counter"


Package Files

interface.go noop.go

type GoRoutineCounter Uses

type GoRoutineCounter interface {
    // Add adds the given delta to the count of active goroutines.
    // Call Add(1) before forking a goroutine, Add(-1) at the end of that goroutine.
    // Call Add(-1) just before waiting on something from another goroutine (e.g.,
    // just before a `select`).
    // Call Add(1) just before doing something that unblocks a goroutine that is
    // waiting on that something.
    Add(delta int)

GoRoutineCounter keeps track of the number of active goroutines working on/for something. This is a utility that makes such code more testable. The code uses this utility to report the number of active goroutines to the test code, so that the test code can advance a fake clock when and only when the code being tested has finished all the work that is ready to do at the present time.

type NoOp Uses

type NoOp struct{}

NoOp is a GoRoutineCounter that does not actually count

func (NoOp) Add Uses

func (NoOp) Add(int)

Add would adjust the count, if a count were being kept

Package counter is imported by 8 packages. Updated 2020-02-14. Refresh now. Tools for package owners.