Documentation
¶
Index ¶
- Variables
- func PanicExcept(f func() error) (err error, trace string)
- func SetProcTitle(title string) error
- type BaseProcess
- type BaseRoutine
- type BaseTasklet
- type CommandHandler
- type ExtRtManager
- 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 PanicExcept ¶
run function f, return err and trace if function panics
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
func (*BaseProcess) SetSignal ¶
func (pr *BaseProcess) SetSignal(sig os.Signal, fn SignalHandler)
func (*BaseProcess) Start ¶
func (pr *BaseProcess) Start()
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 NewTaskletManager ¶
func NewTaskletManager(log *xlog.Logger, tsk Tasklet) *BaseTasklet
func (*BaseTasklet) IsKillEvent ¶
func (tl *BaseTasklet) IsKillEvent() bool
func (*BaseTasklet) IsTermEvent ¶
func (tl *BaseTasklet) IsTermEvent() bool
func (*BaseTasklet) Kill ¶
func (tl *BaseTasklet) Kill()
func (*BaseTasklet) Sleep ¶
func (tl *BaseTasklet) Sleep(timeout float64) bool
func (*BaseTasklet) Start ¶
func (tl *BaseTasklet) Start()
func (*BaseTasklet) Stop ¶
func (tl *BaseTasklet) Stop()
type CommandHandler ¶ added in v0.3.6
command handling callback function definition args: manager handler, received command return: reply message and error
type ExtRtManager ¶
type ExtRtManager struct { *RtManager // management pipes path and handlers PipeDir string // pipe read polling delay PollInterval float64 // command handler callback function CommandHandler CommandHandler // contains filtered or unexported fields }
extended routine manager with management through named pipes manager uses 2 pipes: 1 for input and 1 for output
func NewExtRtManager ¶
func NewExtRtManager(log *xlog.Logger) *ExtRtManager
func (*ExtRtManager) CheckCommand ¶
func (rm *ExtRtManager) CheckCommand() error
func (*ExtRtManager) Execute ¶
func (rm *ExtRtManager) Execute() error
func (*ExtRtManager) Initialize ¶
func (rm *ExtRtManager) Initialize() error
func (*ExtRtManager) Terminate ¶
func (rm *ExtRtManager) Terminate() error
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
type SignalHandler ¶
type SignalHandler func()
Click to show internal directories.
Click to hide internal directories.