processor

package
v6.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2017 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Collector   collector.EventCollector
	PUHandler   ProcessingUnitsHandler
	SyncHandler SynchronizationHandler
	MergeTags   []string
}

Config holds configuration for all monitors

func (*Config) IsComplete

func (c *Config) IsComplete() error

IsComplete checks if configuration is complete

type ProcessingUnitsHandler

type ProcessingUnitsHandler interface {

	// CreatePURuntime is called when a monitor detects creation of a new ProcessingUnit.
	CreatePURuntime(contextID string, runtimeInfo *policy.PURuntime) error

	// HandlePUEvent is called by all monitors when a PU event is generated. The implementer
	// is responsible to update all components by explicitly adding a new PU.
	HandlePUEvent(contextID string, event events.Event) error
}

A ProcessingUnitsHandler must be implemnted by the monitor instantiators or components thereof.

type Processor

type Processor interface {

	// Start processes PU start events
	Start(eventInfo *events.EventInfo) error

	// Event processes PU stop events
	Stop(eventInfo *events.EventInfo) error

	// Create process a PU create event
	Create(eventInfo *events.EventInfo) error

	// Event process a PU destroy event
	Destroy(eventInfo *events.EventInfo) error

	// Event processes a pause event
	Pause(eventInfo *events.EventInfo) error

	// ReSync resyncs all PUs handled by this processor
	ReSync(EventInfo *events.EventInfo) error
}

Processor is a generic interface that processes monitor events using a normalized event structure.

type Registerer

type Registerer interface {

	// Register Processor registers event processors for a certain type of PU
	RegisterProcessor(puType constants.PUType, p Processor) error

	GetHandler(puType constants.PUType, e events.Event) (events.EventHandler, error)
}

Registerer inteface allows event processors to register themselves with the event server.

func New

func New() Registerer

New returns a new registerer

type SynchronizationHandler

type SynchronizationHandler interface {

	// HandleSynchronization handles a synchronization routine.
	HandleSynchronization(contextID string, state events.State, RuntimeReader policy.RuntimeReader, syncType SynchronizationType) error

	// HandleSynchronizationComplete is called when a synchronization job is complete.
	HandleSynchronizationComplete(syncType SynchronizationType)
}

A SynchronizationHandler must be implemnted by the monitor instantiators or components thereof.

type SynchronizationType

type SynchronizationType int

A SynchronizationType represents the type of synchronization job.

const (
	// SynchronizationTypeInitial indicates the initial synchronization job.
	SynchronizationTypeInitial SynchronizationType = iota + 1

	// SynchronizationTypePeriodic indicates subsequent synchronization jobs.
	SynchronizationTypePeriodic
)

Directories

Path Synopsis
Package mockprocessor is a generated GoMock package.
Package mockprocessor is a generated GoMock package.

Jump to

Keyboard shortcuts

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