modes

package
v0.0.0-...-b698297 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2015 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeNone = iota
	ModeStarting
	ModeStarted
	ModeStopping
	ModeStopped
)

Variables

View Source
var AllModes = []ExecutableMode{}

Functions

func RunConfiguredMode

func RunConfiguredMode(config *util.Config) bool

Runs the mode that is activated within the specified config instance, returning false if the mode stopped due to a kill or interrupt and true when the mode stopped due to an error.

Types

type ClientMode

type ClientMode struct {
	// contains filtered or unexported fields
}

func NewClientMode

func NewClientMode() *ClientMode

func (*ClientMode) IsConfigAcceptable

func (self *ClientMode) IsConfigAcceptable(config *util.Config) bool

func (*ClientMode) Name

func (self *ClientMode) Name() string

func (*ClientMode) Start

func (self *ClientMode) Start(config *util.Config) error

func (*ClientMode) Status

func (self *ClientMode) Status() *util.AtomicInt32

func (*ClientMode) Stop

func (self *ClientMode) Stop()

type ExecutableMode

type ExecutableMode interface {
	util.ConfigVerifier

	// Returns the name of the mode.
	Name() string
	// Returns the status of the mode.
	Status() *util.AtomicInt32
	// Start the mode and returns after the mode has been started.
	Start(config *util.Config) error
	// Stops the mode.
	Stop()
}

Defines an interface for implementations of a run mode of this util.

func GetConfiguredMode

func GetConfiguredMode(config *util.Config) ExecutableMode

Returns the mode that is activated within the specified config instance.

func RegisterMode

func RegisterMode(mode ExecutableMode) ExecutableMode

Registers a run mode implementation.

type ExecutableModeListener

type ExecutableModeListener func(mode ExecutableMode, nextStatus int32, config *util.Config)

Defines a callback that is notified when a mode is before start, started or stopped.

func RegisterModeListener

func RegisterModeListener(listener ExecutableModeListener) ExecutableModeListener

Registers a mode listener.

type ServerMode

type ServerMode struct {
	// contains filtered or unexported fields
}

func NewServerMode

func NewServerMode() *ServerMode

func (*ServerMode) IsConfigAcceptable

func (self *ServerMode) IsConfigAcceptable(config *util.Config) bool

func (*ServerMode) Name

func (self *ServerMode) Name() string

func (*ServerMode) Start

func (self *ServerMode) Start(config *util.Config) error

func (*ServerMode) Status

func (self *ServerMode) Status() *util.AtomicInt32

func (*ServerMode) Stop

func (self *ServerMode) Stop()

Jump to

Keyboard shortcuts

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