Documentation ¶
Index ¶
- Constants
- func Decode(rawConfig map[string]interface{}, obj interface{}) error
- func EmitEvent(name string, event interface{}) error
- func RegisterEventHook(name string, hook EventHook) error
- func RegisterPlugin(name string, plugin Plugin) error
- type Config
- type EventHook
- type OnAdminAPIStartup
- type OnReload
- type OnStartup
- type Plugin
- type SetupFunc
Constants ¶
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 ¶
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 ¶
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 ¶
RegisterEventHook plugs in hook. All the hooks should register themselves and they must have a name.
func RegisterPlugin ¶
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 EventHook ¶
type EventHook func(event interface{}) error
EventHook is a type which holds information about a startup hook plugin.
type OnAdminAPIStartup ¶
OnAdminAPIStartup represents a event that happens when Janus starts up the admin API
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 SetupFunc ¶
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 ¶
DirectiveAction gets the action for a plugin