plugin

package
v2.2.0-alpha+incompatible Latest Latest
Warning

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

Go to latest
Published: May 9, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultPlugin = *NewPlugin()

DefaultPlugin is a default instance of IfPlugin.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	infra.PluginDeps

	// the plugin depends on KVScheduler because it needs to register the descriptor(s)
	KVScheduler kvs.KVScheduler
}

Deps lists dependencies of the mock interface plugin.

type Option

type Option func(*SkeletonPlugin)

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

func UseDeps

func UseDeps(f func(*Deps)) Option

UseDeps returns Option that can inject custom dependencies.

type SkeletonPlugin

type SkeletonPlugin struct {
	Deps
}

SkeletonPlugin is a plugin skeleton that you can start building your own plugins from.

func NewPlugin

func NewPlugin(opts ...Option) *SkeletonPlugin

NewPlugin creates a new Plugin with the provides Options

func (*SkeletonPlugin) Close

func (p *SkeletonPlugin) Close() error

Close method usually:

  • stops all the associated go routines (if any)
  • closes channels, registrations, etc..

Note: it is not needed to un-register descriptors - there is no method for

that anyway

func (*SkeletonPlugin) Init

func (p *SkeletonPlugin) Init() error

Init method usually:

  • loads configuration from a file (if any)
  • registers descriptors for all objects the plugin implements
  • potentially starts go routine to watch for some asynchronous events (from which usually sends notifications to KVScheduler via PushSBNotification)
  • etc.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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