util

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Expire

type Expire struct {
	// contains filtered or unexported fields
}

Expire implements a simple last-seen-time-based expiry logic for watching for disappearing entities (for triggering events or just cache housekeeping). User classes define an expiry delay, then call Update every time they encounter a given entity. ComputeExpires() returns the entity names that have not been seen for longer than the configured delay.

func NewExpire

func NewExpire(duration time.Duration) *Expire

NewExpire creates a new Expire object.

func (*Expire) ComputeExpires

func (e *Expire) ComputeExpires() []workloadmeta.EntityID

ComputeExpires returns a list of IDs that have not been seen in the Expire's duration.

func (*Expire) Update

func (e *Expire) Update(id workloadmeta.EntityID, ts time.Time) bool

Update marks the time an ID was last seen. Returns true if the ID is new, false if it was already present in the store.

Jump to

Keyboard shortcuts

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