module

package
v0.2.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetModOptVal

func GetModOptVal(opts map[string]string, key string) string

func InitializeDefaultModules

func InitializeDefaultModules() error

func ModuleInstances

func ModuleInstances() <-chan *ModuleInstance

func ModuleTypes

func ModuleTypes() <-chan *ModuleType

func RegisterModule

func RegisterModule(
	name string,
	ignoreFailOnInit bool,
	initFunc Init,
	defaultConfigs []*ModuleConfig) int32

func StartDefaultModules

func StartDefaultModules() error

func StartModule

func StartModule(modInstId int32) error

Types

type Init

type Init func(id int32, config *ModuleConfig) (Module, error)

Init initializes the module.

type Module

type Module interface {

	// Id gets the module's unique identifier.
	Id() int32

	// Start starts the module.
	Start() error

	// Stop signals the module to stop.
	Stop() error

	// Name is the name of the module.
	Name() string

	// Address is the network address at which the module is available.
	Address() string

	// Description is a free-form field ot add descriptive information about
	// the module instance.
	Description() string
}

Module is the interface to which types adhere in order to participate as daemon modules.

type ModuleConfig

type ModuleConfig struct {
	Address string         `json:"address"`
	Config  *config.Config `json:"config,omitempty"`
}

type ModuleInstance

type ModuleInstance struct {
	Id          int32         `json:"id"`
	Type        *ModuleType   `json:"-"`
	TypeId      int32         `json:"typeId"`
	Inst        Module        `json:"-"`
	Name        string        `json:"name"`
	Config      *ModuleConfig `json:"config,omitempty"`
	Description string        `json:"description"`
	IsStarted   bool          `json:"started"`
}

func GetModuleInstance

func GetModuleInstance(modInstId int32) (*ModuleInstance, error)

func InitializeModule

func InitializeModule(
	modTypeId int32,
	modConfig *ModuleConfig) (*ModuleInstance, error)

type ModuleType

type ModuleType struct {
	Id               int32           `json:"id"`
	Name             string          `json:"name"`
	IgnoreFailOnInit bool            `json:"-"`
	InitFunc         Init            `json:"-"`
	DefaultConfigs   []*ModuleConfig `json:"defaultConfigs"`
}

Directories

Path Synopsis
docker

Jump to

Keyboard shortcuts

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