servers

package
v0.0.0-...-c063610 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2015 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start()

Start starts all server instances.

func StartNamed

func StartNamed(serverNames ...string)

StartNamed starts the named server instances.

func Stop

func Stop()

Stop stops all server instances.

func StopNamed

func StopNamed(serverNames ...string)

StopNamed stops the named server instances.

Types

type Instance

type Instance interface {
	// Run runs the server, passing in the channel it should listen on for
	// stop command.
	Run(stopChan <-chan struct{})

	// Init initializes server resources. In particular this will be called everytime
	// a server is started. It should re-initialize all server state.
	Init()
}

Instance is an instance of a server that is being monitored. A server implementing this interface must be restartable.

type Server

type Server struct {
	tomb.Tomb
	Instance
	// contains filtered or unexported fields
}

Server is an instance of server that can be started, stopped and queried for status. A server is a go routine.

func (*Server) Start

func (s *Server) Start()

Start starts a server instance. It handles marking a server as done when it has finished running.

func (*Server) Status

func (s *Server) Status() Status

Status returns the current status of the server.

func (*Server) Stop

func (s *Server) Stop()

Stop stops a server instance.

type Status

type Status int

Status the status of a server

const (
	// Running server is still alive and responding to requests
	Running Status = iota

	// Stopping server is shutting down
	Stopping

	// Stopped server is no longer running
	Stopped
)

func (Status) String

func (s Status) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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