pods

package
v0.0.24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Setup

func Setup(ctx context.Context, coreFactory *core.Factory, httpClient client_plugin.HTTPClient)

Types

type Heartbeat added in v0.0.23

type Heartbeat struct {
	Clock clockwork.Clock
	// contains filtered or unexported fields
}

Heartbeat will call the provided HeartbeatFunc on the supplied period for each enqueued element.

func NewHeartbeat added in v0.0.23

func NewHeartbeat(period time.Duration, fn HeartbeatFunc) *Heartbeat

func (*Heartbeat) Dequeue added in v0.0.23

func (h *Heartbeat) Dequeue(id string)

Dequeue removes the heartbeat associated with the id from the list. This is roughly a log(n) runtime. There is _some_ scanning involved, but it's only in the event that two heartbeats are scheduled at the same time.

func (*Heartbeat) Enqueue added in v0.0.23

func (h *Heartbeat) Enqueue(ctx context.Context, id string)

Enqueue adds the provided id to the list of elements to process. If runNow is true, then the element is enqueued using the current timestamp rather than one in the future. This operation should be close to log(n) runtime.

func (*Heartbeat) Poll added in v0.0.23

func (h *Heartbeat) Poll(ctx context.Context)

Poll reads from the head of the queue until we reach an entry with a greater timestamp.

func (*Heartbeat) Start added in v0.0.23

func (h *Heartbeat) Start(ctx context.Context)

Start forks a go routine until the provided context is cancelled. Every 200 ms, it attempts to poll the underlying queue for entries that need to be processed.

type HeartbeatFunc added in v0.0.23

type HeartbeatFunc func(ctx context.Context, id string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL