Documentation ¶
Overview ¶
Package modconfig provides matchers for config.Map that query modules registry and parse inline module definitions.
They should be used instead of manual querying when there is need to reference a module instance in the configuration.
See ModuleFromNode documentation for explanation of what is 'args' for some functions (DeliveryTarget).
Index ¶
- func AuthDirective(m *config.Map, node *config.Node) (interface{}, error)
- func DeliveryDirective(m *config.Map, node *config.Node) (interface{}, error)
- func DeliveryTarget(globals map[string]interface{}, args []string, block *config.Node) (module.DeliveryTarget, error)
- func GroupFromNode(defaultModule string, args []string, inlineCfg *config.Node, ...) error
- func MessageCheck(globals map[string]interface{}, args []string, block *config.Node) (module.Check, error)
- func ModuleFromNode(args []string, inlineCfg *config.Node, globals map[string]interface{}, ...) error
- func MsgModifier(globals map[string]interface{}, args []string, block *config.Node) (module.Modifier, error)
- func StorageDirective(m *config.Map, node *config.Node) (interface{}, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeliveryDirective ¶
deliveryDirective is a callback for use in config.Map.Custom.
It does all work necessary to create a module instance from the config directive with the following structure:
directive_name mod_name [inst_name] [{ inline_mod_config }]
Note that if used configuration structure lacks directive_name before mod_name - this function should not be used (call DeliveryTarget directly).
func DeliveryTarget ¶
func GroupFromNode ¶
func GroupFromNode(defaultModule string, args []string, inlineCfg *config.Node, globals map[string]interface{}, moduleIface interface{}) error
GroupFromNode provides a special kind of ModuleFromNode syntax that allows to omit the module name when defining inine configuration. If it is not present, name in defaultModule is used.
func MessageCheck ¶
func ModuleFromNode ¶
func ModuleFromNode(args []string, inlineCfg *config.Node, globals map[string]interface{}, moduleIface interface{}) error
ModuleFromNode does all work to create or get existing module object with a certain type. It is not used by top-level module definitions, only for references from other modules configuration blocks.
inlineCfg should contain configuration directives for inline declarations. args should contain values that are used to create module. It should be either module name + instance name or just module name. Further extensions may add other string arguments (currently, they can be accessed by module instances as inlineArgs argument to constructor).
It checks using reflection whether it is possible to store a module object into modObj pointer (e.g. it implements all necessary interfaces) and stores it if everything is fine. If module object doesn't implement necessary module interfaces - error is returned. If modObj is not a pointer, ModuleFromNode panics.
func MsgModifier ¶
Types ¶
This section is empty.