crank

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2014 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PROCESS_STARTING = ProcessState(1 << iota)
	PROCESS_READY    = ProcessState(1 << iota)
	PROCESS_STOPPING = ProcessState(1 << iota)
)
View Source
const DEFAULT_PREFIX = "/var/crank"
View Source
const VERSION = "0.1.4"

Variables

View Source
var DefaultConfig = &ProcessConfig{
	Cwd:          "",
	Command:      []string{},
	StartTimeout: time.Second * 30,
	StopTimeout:  time.Second * 30,
}
View Source
var EMPTY_BYTES = []byte{}
View Source
var EmptyProcessSet = make(processSet)

Functions

func DefaultConf

func DefaultConf(conf, prefix, name string) string

func DefaultCtl

func DefaultCtl(ctl, prefix, name string) string

func NewRPCServer

func NewRPCServer(m *Manager) *rpc.Server

func Prefix

func Prefix(prefix string) string

Types

type API

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

func (*API) Info

func (self *API) Info(query *InfoQuery, reply *InfoReply) error

func (*API) Kill

func (self *API) Kill(query *KillQuery, reply *KillReply) (err error)

func (*API) Ps

func (self *API) Ps(query *PsQuery, reply *PsReply) error

func (*API) Run

func (self *API) Run(query *StartQuery, reply *StartReply) error

type Action

type Action interface{}

type ByteCount

type ByteCount int64

func (ByteCount) String

func (b ByteCount) String() string

type Event

type Event interface{}

type Info

type Info struct {
	NumGoroutine int
	Version      string
	Build        string
}

func GetInfo

func GetInfo(build string) *Info

func (*Info) String

func (info *Info) String() string

type InfoAction

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

type InfoQuery

type InfoQuery struct{}

type InfoReply

type InfoReply struct {
	Info *Info
}

type KillAction

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

type KillQuery

type KillQuery struct {
	ProcessQuery
	Signal string
	Wait   bool
}

type KillReply

type KillReply struct{}

type Manager

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

Manager manages multiple process groups

func NewManager

func NewManager(build string, configPath string, socket *os.File) *Manager

func (*Manager) Reload

func (self *Manager) Reload()

Restart queues and starts excecuting a restart job to replace the old process group with a new one.

func (*Manager) Run

func (self *Manager) Run()

Run starts the event loop for the manager process

func (*Manager) SendAction

func (self *Manager) SendAction(action Action)

func (*Manager) Shutdown

func (self *Manager) Shutdown()

type PrefixReader

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

func NewLinePrefixer

func NewLinePrefixer(r io.Reader, prefix func() string) *PrefixReader

func (*PrefixReader) Read

func (io *PrefixReader) Read(buf []byte) (n int, err error)

type Process

type Process struct {
	*os.Process
	// contains filtered or unexported fields
}

func (*Process) Pid

func (p *Process) Pid() int

func (*Process) Shutdown

func (p *Process) Shutdown() error

func (*Process) String

func (p *Process) String() string

type ProcessConfig

type ProcessConfig struct {
	Cwd          string        `json:"cwd"`
	Command      []string      `json:"command"`
	StartTimeout time.Duration `json:"start_timeout"`
	StopTimeout  time.Duration `json:"stop_timeout"`
}

func (*ProcessConfig) String

func (self *ProcessConfig) String() string

type ProcessExitEvent

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

type ProcessInfo

type ProcessInfo struct {
	Pid     int
	Cid     int
	State   string
	Cwd     string
	Command []string
}

func (*ProcessInfo) String

func (pi *ProcessInfo) String() string

type ProcessQuery

type ProcessQuery struct {
	Starting bool
	Ready    bool
	Stopping bool
	Pid      int
}

Used by other query structs

type ProcessReadyEvent

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

type ProcessState

type ProcessState int

func (ProcessState) String

func (ps ProcessState) String() string

type PsAction

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

type PsQuery

type PsQuery struct {
	ProcessQuery
}

type PsReply

type PsReply struct {
	PS []*ProcessInfo
}

type ShutdownAction

type ShutdownAction bool

type StartAction

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

type StartQuery

type StartQuery struct {
	Command      []string
	Cwd          string
	StartTimeout int
	StopTimeout  int
	Wait         bool
	Pid          int
}

type StartReply

type StartReply struct {
	Code int
}

type TimeoutTracker

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

func NewTimeoutTracker

func NewTimeoutTracker() *TimeoutTracker

func (*TimeoutTracker) Add

func (self *TimeoutTracker) Add(p *Process, timeout time.Duration)

func (*TimeoutTracker) Remove

func (self *TimeoutTracker) Remove(p *Process)

func (*TimeoutTracker) Run

func (self *TimeoutTracker) Run()

func (*TimeoutTracker) Stop

func (self *TimeoutTracker) Stop()

Jump to

Keyboard shortcuts

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