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
- func ValidateConfig(name string, rawConfig Config) (bool, error)
- type Config
- type EventHook
- type OnAdminAPIStartup
- type OnReload
- type OnStartup
- type Plugin
- type SetupFunc
- type ValidateFunc
Constants ¶
const ( StartupEvent = "startup" AdminAPIStartupEvent = "admin_startup" ReloadEvent = "reload" ShutdownEvent = "shutdown" SetupEvent = "setup" )
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 OnReload ¶
type OnReload struct {
Configurations []*api.Definition
}
OnReload represents a event that happens when Janus hot reloads it's configurations
type OnStartup ¶
type OnStartup struct { StatsClient client.Client MongoSession *mgo.Session Register *proxy.Register Config *config.Specification Configuration []*api.Definition }
OnStartup represents a event that happens when Janus starts up on the main process
type Plugin ¶
type Plugin struct { Action SetupFunc Validate ValidateFunc }
Plugin defines basic methods for plugins
type SetupFunc ¶
type SetupFunc func(def *proxy.RouterDefinition, 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 ¶
DirectiveAction gets the action for a plugin
type ValidateFunc ¶
ValidateFunc validates configuration data against the plugin struct