Documentation
¶
Index ¶
- Variables
- func SetProcTitle(title string) error
- type BaseProcess
- type BaseRoutine
- type BaseTasklet
- type CommandHandler
- type Routine
- type RtManager
- func (rm *RtManager) AddRoutine(name string, rt Routine, active bool) error
- func (rm *RtManager) CheckRoutines() error
- func (rm *RtManager) DelRoutine(name string) error
- func (rm *RtManager) Execute() error
- func (rm *RtManager) Initialize() error
- func (rm *RtManager) ListRoutines() []string
- func (rm *RtManager) RestartRoutine(name string) error
- func (rm *RtManager) StartRoutine(name string) error
- func (rm *RtManager) StopRoutine(name string) error
- func (rm *RtManager) Terminate() error
- type SignalHandler
- type Tasklet
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrRtError = errors.New("") ErrNoRoutines = fmt.Errorf("%wno routines loaded", ErrRtError) ErrInvalidRoutine = fmt.Errorf("%winvalid routine name", ErrRtError) ErrDuplicateRoutine = fmt.Errorf("%wduplicate routine name", ErrRtError) ErrRoutineActive = fmt.Errorf("%wroutine is active", ErrRtError) )
Functions ¶
func SetProcTitle ¶
set process title in OS process table, max 16 char
Types ¶
type BaseProcess ¶
type BaseProcess struct { *BaseTasklet // process title as shown in OS process table ProcTitle string // contains filtered or unexported fields }
func NewBaseProcess ¶
func NewBaseProcess(log *xlog.Logger, tsk Tasklet) *BaseProcess
create new base process
func (*BaseProcess) InitManagement ¶ added in v0.3.8
func (pr *BaseProcess) InitManagement( ipipe, opipe *xpipe.Pipe, hnd CommandHandler)
initialize process management
func (*BaseProcess) SetSignal ¶
func (pr *BaseProcess) SetSignal(sig os.Signal, fn SignalHandler)
add signal handler
func (*BaseProcess) Start ¶
func (pr *BaseProcess) Start()
func (*BaseProcess) Stop ¶ added in v0.3.8
func (pr *BaseProcess) Stop()
type BaseRoutine ¶
type BaseRoutine struct { *BaseTasklet Name string // contains filtered or unexported fields }
func NewBaseRoutine ¶
func NewBaseRoutine(tsk Tasklet) *BaseRoutine
func (*BaseRoutine) IsAlive ¶
func (rt *BaseRoutine) IsAlive() bool
func (*BaseRoutine) Parent ¶
func (rt *BaseRoutine) Parent() *RtManager
func (*BaseRoutine) Start ¶
func (rt *BaseRoutine) Start()
type BaseTasklet ¶
type BaseTasklet struct { Log *xlog.Logger // error delay for execution loop ErrorDelay float64 // contains filtered or unexported fields }
func NewBaseTasklet ¶ added in v0.3.8
func NewBaseTasklet(log *xlog.Logger, tsk Tasklet) *BaseTasklet
func (*BaseTasklet) IsKillEvent ¶
func (tl *BaseTasklet) IsKillEvent() bool
check if kill event is set
func (*BaseTasklet) IsTermEvent ¶
func (tl *BaseTasklet) IsTermEvent() bool
check if terminate event is set
func (*BaseTasklet) SafeExecute ¶ added in v0.3.8
func (tl *BaseTasklet) SafeExecute(f func() error) bool
run function with error and panic handling
type CommandHandler ¶ added in v0.3.6
command handling callback function takes received command and return reply message
type RtManager ¶
type RtManager struct { *BaseProcess // routines monitoring interval in sec MonInterval float64 // delay to wait for routine terminate in sec TermDelay float64 // contains filtered or unexported fields }
func NewRtManager ¶
func (*RtManager) AddRoutine ¶
add new routine handler to manager
func (*RtManager) CheckRoutines ¶
monitor routines and start/stop as per each routine status
func (*RtManager) DelRoutine ¶
delete routine handler from manager
func (*RtManager) ListRoutines ¶
return name list of all current loaded routines
func (*RtManager) RestartRoutine ¶
restart routine
Click to show internal directories.
Click to hide internal directories.