apiserver: k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/testing/clock Index | Files

package clock

import "k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/testing/clock"

Index

Package Files

event_clock.go

type EventClock Uses

type EventClock interface {
    clock.PassiveClock
    EventAfterDuration(f EventFunc, d time.Duration)
    EventAfterTime(f EventFunc, t time.Time)
}

EventClock fires event on time

type EventFunc Uses

type EventFunc func(time.Time)

EventFunc does some work that needs to be done at or after the given time. After this function returns, associated work may continue

on other goroutines only if they are counted by the GoRoutineCounter

of the FakeEventClock handling this EventFunc.

type FakeEventClock Uses

type FakeEventClock struct {
    clock.FakePassiveClock
    // contains filtered or unexported fields
}

FakeEventClock is one whose time does not pass implicitly but rather is explicitly set by invocations of its SetTime method

func NewFakeEventClock Uses

func NewFakeEventClock(t time.Time, fuzz time.Duration, r *rand.Rand) (*FakeEventClock, counter.GoRoutineCounter)

NewFakeEventClock constructor. The given `r *rand.Rand` must henceforth not be used for any other purpose. If `r` is nil then a fresh one will be constructed, seeded with the current real time. The clientWG can be `nil` and if not is used to let Run know about additional work that has to complete before time can advance.

func (*FakeEventClock) EventAfterDuration Uses

func (fec *FakeEventClock) EventAfterDuration(f EventFunc, d time.Duration)

EventAfterDuration schedules the given function to be invoked once the given duration has passed.

func (*FakeEventClock) EventAfterTime Uses

func (fec *FakeEventClock) EventAfterTime(f EventFunc, t time.Time)

EventAfterTime schedules the given function to be invoked once the given time has arrived.

func (*FakeEventClock) GetNextTime Uses

func (fec *FakeEventClock) GetNextTime() (time.Time, bool)

GetNextTime returns the next time at which there is work scheduled, and a bool indicating whether there is any such time

func (*FakeEventClock) Run Uses

func (fec *FakeEventClock) Run(limit *time.Time)

Run runs all the events scheduled, and all the events they schedule, and so on, until there are none scheduled or the limit is not nil and the next time would exceed the limit. The clientWG given in the constructor gates each advance of time.

func (*FakeEventClock) SetTime Uses

func (fec *FakeEventClock) SetTime(t time.Time)

SetTime sets the time and runs to completion all events that should be started by the given time --- including any further events they schedule

type RealEventClock Uses

type RealEventClock struct {
    clock.RealClock
}

RealEventClock fires event on real world time

func (RealEventClock) EventAfterDuration Uses

func (RealEventClock) EventAfterDuration(f EventFunc, d time.Duration)

EventAfterDuration schedules an EventFunc

func (RealEventClock) EventAfterTime Uses

func (r RealEventClock) EventAfterTime(f EventFunc, t time.Time)

EventAfterTime schedules an EventFunc

Package clock imports 9 packages (graph). Updated 2020-09-01. Refresh now. Tools for package owners.