fence

package
v0.0.0-...-c34bea4 Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fencer

type Fencer map[string]uint64

Fencer provides a method set to prevent processing out of order events.

Fencer will keep track of the last seen revision (monotonically increasing event id) for each seen UUID (globally unique identifier for a resource producing an event.)

func (Fencer) Clear

func (f Fencer) Clear(uuid string)

Clear removes the uuid and revision from its internal storage.

This method should only be invoked once the caller can ensure the provided UUID will not be seen again.

func (Fencer) Fence

func (f Fencer) Fence(m Meta) bool

Fence evalutes the passed in meta and informs the caller whether to not process the event (fence) or not process the event (no fence)

True is returned when the caller should fence the event. False is returned when the caller should not.

type Meta

type Meta struct {
	// UUID is an immutable identifier for resource producing
	// this event.
	UUID string
	// Rev is a revision number in a total order of revision numbers
	// for the resource producing this event.
	Rev uint64
}

Meta provides metadata from the resource which triggered this package's events.

func (*Meta) FromObjectMeta

func (m *Meta) FromObjectMeta(om *v1.ObjectMeta) error

FromSlimObjectMeta allocates a meta derived from a k8s ObjectMeta and stores it at the memory pointed to by m.

func (*Meta) FromSlimObjectMeta

func (m *Meta) FromSlimObjectMeta(om *slim_metav1.ObjectMeta) error

FromSlimObjectMeta allocates a meta derived from a slim k8s ObjectMeta and stores it at the memory pointed to by m.

Jump to

Keyboard shortcuts

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