collector

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2020 License: Apache-2.0 Imports: 5 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Observation

type Observation struct {
	LastEventType event.EventType

	AggregateStatus status.Status

	ResourceStatuses []*event.ResourceStatus

	Error error
}

Observation contains the latest state known by the collector as returned by a call to the LatestObservation function.

type ResourceStatusCollector

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

ResourceStatusCollector is for use by clients of the polling library and provides a way to keep track of the latest status/state for all the polled resources. The collector is set up to listen to the eventChannel and keep the latest event for each resource. It also provides a way to fetch the latest state for all resources and the aggregated status at any point. The functions already handles synchronization so it can be used by multiple goroutines.

func NewResourceStatusCollector

func NewResourceStatusCollector(identifiers []object.ObjMetadata) *ResourceStatusCollector

func (*ResourceStatusCollector) LatestObservation

func (o *ResourceStatusCollector) LatestObservation() *Observation

LatestObservation returns an Observation instance, which contains the latest information about the resources known by the collector.

func (*ResourceStatusCollector) Listen

func (o *ResourceStatusCollector) Listen(eventChannel <-chan event.Event, stop <-chan struct{}) <-chan struct{}

Listen kicks off the goroutine that will listen for the events on the eventChannel. It is also provided a stop channel that can be used by the caller to stop the collector before the eventChannel is closed. It returns a channel that will be closed the collector stops listening to the eventChannel.

Jump to

Keyboard shortcuts

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