resync

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2017 License: Apache-2.0 Imports: 5 Imported by: 123

Documentation

Overview

Package resync implements the mechanism to notify previously registered plugins that the resync procedure needs to start.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	local.PluginLogDeps // inject
}

Deps is here to group injected dependencies of plugin to not mix with other plugin fields.

type Plugin

type Plugin struct {
	Deps
	// contains filtered or unexported fields
}

Plugin implements Plugin interface therefore can be loaded with other plugins

func (*Plugin) AfterInit

func (plugin *Plugin) AfterInit() (err error)

AfterInit method starts the resync

func (*Plugin) Close

func (plugin *Plugin) Close() error

Close TODO set flag that ignore errors => not start Resync while agent is stopping TODO kill existing Resync timeout while agent is stopping

func (*Plugin) Init

func (plugin *Plugin) Init() (err error)

Init initializes variables

func (*Plugin) Register

func (plugin *Plugin) Register(resyncName string) Registration

Register function is supposed to be called in Init() by all VPP Agent plugins. The plugins are supposed to load current state of their objects when newResync() is called. But the actual CreateNewObjects(), DeleteObsoleteObjects() and ModifyExistingObjects() will be orchestrated to ensure there is proper order of that. If an error occurs during Resync than new Resync is planned.

type Registration

type Registration interface {
	StatusChan() chan StatusEvent
	fmt.Stringer
}

Registration is an interface that is returned by the Register() call

func NewRegistration

func NewRegistration(resyncName string, statusChan chan StatusEvent) Registration

NewRegistration is a constructor

type Reporter

type Reporter interface {
	// ReportError is called by the Plugins when the binary api call was not successful.
	// Based on that the Resync Orchestrator starts the Resync.
	ReportError(name core.PluginName, err error)
}

Reporter is an API for other plugins that needs to report to RESYNC Orchestrator. Intent of this API is to have a chance to react on error by triggering RESYNC among registered plugins.

type Status

type Status string

Status status used in the events

const NotActive Status = "NotActive"

NotActive means that Resync has not started yet or it has been finished

const Started Status = "Started"

Started means that the Resync has started

type StatusEvent

type StatusEvent interface {
	// Status() is used by the Plugin if it needs to Start resync
	ResyncStatus() Status

	// Ack() is used by the Plugin to acknowledge that it processed this event.
	// It is supposed to call this after the configuration was applied by the Plugin
	Ack()
}

StatusEvent is the base type that will be propagated to the channel

type Subscriber

type Subscriber interface {
	// Register function is supposed to be called in Init() by all VPP Agent plugins.
	// Those plugins will use Registration.StatusChan() to listen
	// The plugins are supposed to load current state of their objects when newResync() is called.
	Register(resyncName string) Registration
}

Subscriber is an API for other plugins that needs to receive notifications from RESYNC Orcherstrator

Jump to

Keyboard shortcuts

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