plugin

package
v0.0.0-...-43548f9 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StartupEvent         string = "startup"
	AdminAPIStartupEvent string = "admin_startup"

	ReloadEvent   string = "reload"
	ShutdownEvent string = "shutdown"
)

Define the event names for the startup and shutdown events

Variables

This section is empty.

Functions

func Decode

func Decode(rawConfig map[string]interface{}, obj interface{}) error

Decode decodes a map string interface into a struct for some reasons mapstructure.Decode() gives empty arrays for all resulting config fields this is quick workaround hack t make it work FIXME: investigate and fix mapstructure.Decode() behaviour and remove this dirty hack

func EmitEvent

func EmitEvent(name string, event interface{}) error

EmitEvent executes the different hooks passing the EventType as an argument. This is a blocking function. Hook developers should use 'go' keyword if they don't want to block Janus.

func RegisterEventHook

func RegisterEventHook(name string, hook EventHook) error

RegisterEventHook plugs in hook. All the hooks should register themselves and they must have a name.

func RegisterPlugin

func RegisterPlugin(name string, plugin Plugin) error

RegisterPlugin plugs in plugin. All plugins should register themselves, even if they do not perform an action associated with a directive. It is important for the process to know which plugins are available.

The plugin MUST have a name: lower case and one word. If this plugin has an action, it must be the name of the directive that invokes it. A name is always required and must be unique for the server type.

Types

type Config

type Config map[string]interface{}

Config initialization options.

type EventHook

type EventHook func(event interface{}) error

EventHook is a type which holds information about a startup hook plugin.

type OnAdminAPIStartup

type OnAdminAPIStartup struct {
	Router router.Router
}

OnAdminAPIStartup represents a event that happens when Janus starts up the admin API

type OnReload

type OnReload struct {
	Register *proxy.Register
}

OnReload represents a event that happens when Janus hot reloads it's configurations

type OnStartup

type OnStartup struct {
	Notifier     notifier.Notifier
	StatsClient  stats.Client
	MongoSession *mgo.Session
	Register     *proxy.Register
	Config       *config.Specification
}

OnStartup represents a event that happens when Janus starts up on the main process

type Plugin

type Plugin struct {
	Action SetupFunc
}

Plugin defines basic methods for plugins

type SetupFunc

type SetupFunc func(route *proxy.Route, rawConfig Config) error

SetupFunc is used to set up a plugin, or in other words, execute a directive. It will be called once per key for each server block it appears in.

func DirectiveAction

func DirectiveAction(name string) (SetupFunc, error)

DirectiveAction gets the action for a plugin

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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