Documentation
¶
Index ¶
- Constants
- type Daemon
- func (daemon *Daemon) Add(name string, binary string, args ...interface{}) (*Service, error)
- func (daemon *Daemon) IsRunning() bool
- func (daemon *Daemon) IsStopping() bool
- func (daemon *Daemon) Remove(name string) error
- func (daemon *Daemon) Signal(name string, sig syscall.Signal) error
- func (daemon *Daemon) SignalAll(sig syscall.Signal)
- func (daemon *Daemon) Status(name string) *ServiceJSON
- func (daemon *Daemon) Stop(name string) error
- func (daemon *Daemon) StopAll(kill bool)
- func (daemon *Daemon) Supervise() error
- func (daemon *Daemon) Unwatch(watcherCh chan *ServiceJSON)
- func (daemon *Daemon) Watch(watcherCh chan *ServiceJSON)
- type DaemonOption
- type ErrLineBufferOverflow
- type OutputStream
- type Service
- func (svc *Service) Clone(keepState bool) *Service
- func (svc *Service) Done() <-chan struct{}
- func (svc *Service) HasFinalState() bool
- func (svc *Service) HasInitialState() bool
- func (svc *Service) HasRunningState() bool
- func (svc *Service) Signal(sig syscall.Signal) error
- func (svc *Service) Start() <-chan ServiceStatus
- func (svc *Service) Status() ServiceStatus
- func (svc *Service) Stop() error
- type ServiceJSON
- type ServiceOption
- type ServiceStatus
- type State
Constants ¶
View Source
const DefaultLineBufferSize = 16384
View Source
const DefaultStreamChanSize = 1000
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Daemon ¶
func NewDaemon ¶
func NewDaemon(options ...DaemonOption) *Daemon
func (*Daemon) IsStopping ¶
func (*Daemon) Status ¶
func (daemon *Daemon) Status(name string) *ServiceJSON
func (*Daemon) Unwatch ¶
func (daemon *Daemon) Unwatch(watcherCh chan *ServiceJSON)
func (*Daemon) Watch ¶
func (daemon *Daemon) Watch(watcherCh chan *ServiceJSON)
type DaemonOption ¶
type DaemonOption func(daemon *Daemon)
func Logger ¶
func Logger(logger *log.Logger) DaemonOption
func StopOnFailure ¶
func StopOnFailure() DaemonOption
type ErrLineBufferOverflow ¶
func (ErrLineBufferOverflow) Error ¶
func (err ErrLineBufferOverflow) Error() string
type OutputStream ¶
type OutputStream struct {
// contains filtered or unexported fields
}
func NewOutputStream ¶
func NewOutputStream(streamCh chan string) *OutputStream
func (*OutputStream) Lines ¶
func (os *OutputStream) Lines() <-chan string
func (*OutputStream) SetLineBufferSize ¶
func (os *OutputStream) SetLineBufferSize(n int)
type Service ¶
func NewService ¶
func NewService(binary string, args []string, options ...ServiceOption) *Service
func (*Service) HasFinalState ¶
func (*Service) HasInitialState ¶
func (*Service) HasRunningState ¶
func (*Service) Start ¶
func (svc *Service) Start() <-chan ServiceStatus
func (*Service) Status ¶
func (svc *Service) Status() ServiceStatus
type ServiceJSON ¶
type ServiceJSON struct { Name string `json:"name"` Command string `json:"command"` State string `json:"state"` PID int `json:"pid"` ExitCode int `json:"exitCode"` Error error `json:"error"` RetryCount uint `json:"retryCount"` RetryLimit uint `json:"retryLimit"` IsCompleted bool `json:"isCompleted"` }
type ServiceOption ¶
type ServiceOption func(svc *Service)
func Retries ¶
func Retries(times uint) ServiceOption
func StartDelay ¶
func StartDelay(delay time.Duration) ServiceOption
type ServiceStatus ¶
Click to show internal directories.
Click to hide internal directories.