resync

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

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

View Source
var DefaultPlugin = *NewPlugin()

DefaultPlugin is a default instance of Plugin.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	infra.PluginName // inject
	Log              logging.PluginLogger
}

Deps groups dependencies injected into the plugin so that they are logically separated from other plugin fields.

type Option added in v1.5.0

type Option func(*Plugin)

Option is a function that can be used in NewPlugin to customize Plugin.

func UseDeps added in v1.5.0

func UseDeps(cb func(*Deps)) Option

UseDeps returns Option that can inject custom dependencies.

type Plugin

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

Plugin implements Plugin interface, therefore it can be loaded with other plugins.

func NewPlugin added in v1.5.0

func NewPlugin(opts ...Option) *Plugin

NewPlugin creates a new Plugin with the provided Options.

func (*Plugin) AfterInit

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

AfterInit method starts the resync.

func (*Plugin) Close

func (p *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) DoResync added in v1.3.0

func (p *Plugin) DoResync()

DoResync can be used to start resync procedure outside of after init

func (*Plugin) Init

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

Init initializes variables.

func (*Plugin) Register

func (p *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. The actual CreateNewObjects(), DeleteObsoleteObjects() and ModifyExistingObjects() will be orchestrated to ensure their proper order. If an error occurs during Resync, then 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 Plugins when the binary api call was not successful.
	// Based on that the Resync Orchestrator starts the Resync.
	ReportError(name infra.PluginName, err error)
}

Reporter is an API for other plugins that need 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 used in the events.

const (
	// Started means that the Resync has started.
	Started Status = "Started"
	// NotActive means that Resync has not started yet or it has been finished.
	NotActive Status = "NotActive"
)

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.
	// This is supposed to be called 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 used by plugins to register for notifications from the RESYNC Orcherstrator.

Jump to

Keyboard shortcuts

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