supervisor

package
v0.0.0-...-06c19a4 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2014 License: MIT Imports: 18 Imported by: 4

Documentation

Index

Constants

View Source
const (
	AgentStateStopped = "stopped"
	AgentStateRunning = "running"
	AgentStateCrashed = "crashed"
	AgentStateKilled  = "killed"
)
View Source
const (
	TokenFile = ".meeko_token"
	TokenLen  = 32
)
View Source
const TerminationTimeout = 5 * time.Second

Variables

View Source
var (
	ErrUnknownAlias    = errors.New("unknown agent alias")
	ErrAgentRunning    = errors.New("agent is running")
	ErrAgentNotRunning = errors.New("agent is not running")
	ErrInterrupted     = errors.New("operation was interrupted")
)

Functions

func ReadOrGenerateToken

func ReadOrGenerateToken(dir string) ([]byte, error)

Types

type ActionContext

type ActionContext interface {
	SignalProgress() error
	Stdout() io.Writer
	Stderr() io.Writer
	Interrupted() <-chan struct{}
}

func NewNilActionContext

func NewNilActionContext() ActionContext

type AgentStateChange

type AgentStateChange struct {
	Alias     string
	FromState string
	ToState   string
}

type ErrNotDefined

type ErrNotDefined struct {
	What string
}

func (*ErrNotDefined) Error

func (err *ErrNotDefined) Error() string

type Implementation

type Implementation interface {
	Install(alias string, repo string, ctx ActionContext) (*data.Agent, error)
	Upgrade(agent *data.Agent, ctx ActionContext) error
	Remove(agent *data.Agent, ctx ActionContext) error

	Start(agent *data.Agent, ctx ActionContext) error
	Stop(alias string, ctx ActionContext) error
	StopWithTimeout(alias string, ctx ActionContext, timeout time.Duration) error
	Kill(alias string, ctx ActionContext) error
	Restart(agent *data.Agent, ctx ActionContext) error
	Status(alias string, ctx ActionContext) (status string, err error)
	Statuses(ctx ActionContext) (statuses map[string]string, err error)

	AgentStateChangeFeed() <-chan *AgentStateChange
	CloseAgentStateChangeFeed()

	Terminate(timeout time.Duration)
}

type Supervisor

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

func New

func New(impl Implementation, workspace, mgoURL, token string, logs *log.Publisher) (*Supervisor, error)

func (*Supervisor) ExportManagementMethods

func (sup *Supervisor) ExportManagementMethods(client *rpc.Service) (err error)

func (*Supervisor) Terminate

func (sup *Supervisor) Terminate()

func (*Supervisor) TerminateWithin

func (sup *Supervisor) TerminateWithin(timeout time.Duration)

func (*Supervisor) Terminated

func (sup *Supervisor) Terminated() <-chan struct{}

Directories

Path Synopsis
implementations
utils

Jump to

Keyboard shortcuts

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