modconfig

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2020 License: MIT Imports: 9 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthDirective

func AuthDirective(m *config.Map, node *config.Node) (interface{}, error)

func DeliveryDirective

func DeliveryDirective(m *config.Map, node *config.Node) (interface{}, error)

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 DeliveryTarget(globals map[string]interface{}, args []string, block *config.Node) (module.DeliveryTarget, error)

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 MessageCheck(globals map[string]interface{}, args []string, block *config.Node) (module.Check, error)

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

func MsgModifier(globals map[string]interface{}, args []string, block *config.Node) (module.Modifier, error)

func StorageDirective

func StorageDirective(m *config.Map, node *config.Node) (interface{}, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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