Documentation
¶
Index ¶
- type Allocator
- type Options
- type Process
- func (w *Process) AttachRelay(rl relay.Relay)
- func (w *Process) Created() time.Time
- func (w *Process) Kill() error
- func (w *Process) Pid() int64
- func (w *Process) Relay() relay.Relay
- func (w *Process) Start() error
- func (w *Process) State() worker.State
- func (w *Process) Stop() error
- func (w *Process) String() string
- func (w *Process) Wait() error
- func (w *Process) Write(p []byte) (n int, err error)
- type StateImpl
- type SyncWorkerImpl
- func (tw *SyncWorkerImpl) AttachRelay(rl relay.Relay)
- func (tw *SyncWorkerImpl) Created() time.Time
- func (tw *SyncWorkerImpl) Exec(p *payload.Payload) (*payload.Payload, error)
- func (tw *SyncWorkerImpl) ExecWithTTL(ctx context.Context, p *payload.Payload) (*payload.Payload, error)
- func (tw *SyncWorkerImpl) Kill() error
- func (tw *SyncWorkerImpl) Pid() int64
- func (tw *SyncWorkerImpl) Relay() relay.Relay
- func (tw *SyncWorkerImpl) Start() error
- func (tw *SyncWorkerImpl) State() worker.State
- func (tw *SyncWorkerImpl) Stop() error
- func (tw *SyncWorkerImpl) String() string
- func (tw *SyncWorkerImpl) Wait() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Allocator ¶
type Allocator func() (worker.SyncWorker, error)
Allocator is responsible for worker allocation in the pool
type Process ¶
type Process struct {
// contains filtered or unexported fields
}
Process - supervised process with api over goridge.Relay.
func InitBaseWorker ¶
InitBaseWorker creates new Process over given exec.cmd.
func (*Process) AttachRelay ¶
AttachRelay attaches relay to the worker
func (*Process) Kill ¶
Kill kills underlying process, make sure to call Wait() func to gather error log from the stderr. Does not wait for process completion!
func (*Process) State ¶
State return receive-only Process state object, state can be used to safely access Process status, time when status changed and number of Process executions.
func (*Process) Stop ¶
Stop sends soft termination command to the Process and waits for process completion.
type StateImpl ¶
type StateImpl struct {
// contains filtered or unexported fields
}
func NewWorkerState ¶
NewWorkerState initializes a state for the sync.Worker
func (*StateImpl) RegisterExec ¶
func (s *StateImpl) RegisterExec()
RegisterExec register new execution atomically
func (*StateImpl) SetLastUsed ¶
SetLastUsed Update last used time
type SyncWorkerImpl ¶
type SyncWorkerImpl struct {
// contains filtered or unexported fields
}
func From ¶
func From(process worker.BaseProcess) *SyncWorkerImpl
From creates SyncWorker from BaseProcess
func (*SyncWorkerImpl) AttachRelay ¶
func (tw *SyncWorkerImpl) AttachRelay(rl relay.Relay)
func (*SyncWorkerImpl) Created ¶
func (tw *SyncWorkerImpl) Created() time.Time
func (*SyncWorkerImpl) ExecWithTTL ¶
func (tw *SyncWorkerImpl) ExecWithTTL(ctx context.Context, p *payload.Payload) (*payload.Payload, error)
ExecWithTTL executes payload without TTL timeout.
func (*SyncWorkerImpl) Kill ¶
func (tw *SyncWorkerImpl) Kill() error
func (*SyncWorkerImpl) Pid ¶
func (tw *SyncWorkerImpl) Pid() int64
func (*SyncWorkerImpl) Relay ¶
func (tw *SyncWorkerImpl) Relay() relay.Relay
func (*SyncWorkerImpl) Start ¶
func (tw *SyncWorkerImpl) Start() error
func (*SyncWorkerImpl) State ¶
func (tw *SyncWorkerImpl) State() worker.State
func (*SyncWorkerImpl) Stop ¶
func (tw *SyncWorkerImpl) Stop() error
func (*SyncWorkerImpl) String ¶
func (tw *SyncWorkerImpl) String() string
func (*SyncWorkerImpl) Wait ¶
func (tw *SyncWorkerImpl) Wait() error