Documentation ¶
Index ¶
- Constants
- Variables
- func IsShutdown() bool
- func RegisterDaemon(daemon Daemon) error
- func RegisterSimpleDaemon(name string, startFunc func(), stopFunc func(sig os.Signal)) error
- func ShutdownFuture() concurrent.Future
- func ShutdownGracefully()
- func Start() error
- func StartDaemon(name string) error
- func Stop(sig os.Signal) error
- func StopDaemon(name string, sig os.Signal) error
- func UnregisterDaemon(name string) error
- type CronSyntax
- type Daemon
- type DaemonEntity
- type DaemonService
- func (s *DaemonService) GetDaemon(name string) *DaemonEntity
- func (s *DaemonService) IsShutdown() bool
- func (s *DaemonService) RegisterDaemon(daemon Daemon) error
- func (s *DaemonService) ShutdownFuture() concurrent.Future
- func (s *DaemonService) ShutdownGracefully()
- func (s *DaemonService) Start() error
- func (s *DaemonService) StartDaemon(entity *DaemonEntity) kkpanic.Caught
- func (s *DaemonService) Stop(sig os.Signal) error
- func (s *DaemonService) StopDaemon(entity *DaemonEntity, sig os.Signal) kkpanic.Caught
- func (s *DaemonService) UnregisterDaemon(name string) error
- type DefaultDaemon
- type DefaultSchedulerDaemon
- type DefaultTimerDaemon
- type Looper
- type PanicResult
- type SchedulerDaemon
- type TimerDaemon
Constants ¶
View Source
const StateRun = int32(2)
View Source
const StateStart = int32(1)
View Source
const StateStop = int32(3)
View Source
const StateWait = int32(0)
Variables ¶
View Source
var DefaultService = NewDaemonService()
Functions ¶
func IsShutdown ¶ added in v1.1.3
func IsShutdown() bool
func RegisterDaemon ¶ added in v1.1.0
func RegisterSimpleDaemon ¶ added in v1.3.0
func ShutdownFuture ¶ added in v1.3.0
func ShutdownFuture() concurrent.Future
func ShutdownGracefully ¶ added in v1.2.0
func ShutdownGracefully()
func StartDaemon ¶ added in v1.4.0
func UnregisterDaemon ¶ added in v1.3.0
Types ¶
type CronSyntax ¶ added in v1.3.0
type CronSyntax string
type DaemonEntity ¶ added in v1.1.0
func GetDaemon ¶ added in v1.3.0
func GetDaemon(name string) *DaemonEntity
type DaemonService ¶ added in v1.3.0
type DaemonService struct { // daemons map DaemonMap sync.Map // stop all daemon when get kill signal, default: `true` StopWhenKill bool // contains filtered or unexported fields }
func NewDaemonService ¶ added in v1.3.0
func NewDaemonService() *DaemonService
func (*DaemonService) GetDaemon ¶ added in v1.3.0
func (s *DaemonService) GetDaemon(name string) *DaemonEntity
func (*DaemonService) IsShutdown ¶ added in v1.3.0
func (s *DaemonService) IsShutdown() bool
func (*DaemonService) RegisterDaemon ¶ added in v1.3.0
func (s *DaemonService) RegisterDaemon(daemon Daemon) error
func (*DaemonService) ShutdownFuture ¶ added in v1.3.0
func (s *DaemonService) ShutdownFuture() concurrent.Future
func (*DaemonService) ShutdownGracefully ¶ added in v1.3.0
func (s *DaemonService) ShutdownGracefully()
func (*DaemonService) Start ¶ added in v1.3.0
func (s *DaemonService) Start() error
func (*DaemonService) StartDaemon ¶ added in v1.4.0
func (s *DaemonService) StartDaemon(entity *DaemonEntity) kkpanic.Caught
func (*DaemonService) StopDaemon ¶ added in v1.4.0
func (s *DaemonService) StopDaemon(entity *DaemonEntity, sig os.Signal) kkpanic.Caught
func (*DaemonService) UnregisterDaemon ¶ added in v1.3.0
func (s *DaemonService) UnregisterDaemon(name string) error
type DefaultDaemon ¶ added in v1.1.0
type DefaultDaemon struct { Params map[string]interface{} // contains filtered or unexported fields }
func (*DefaultDaemon) Name ¶ added in v1.1.6
func (d *DefaultDaemon) Name() string
func (*DefaultDaemon) Registered ¶ added in v1.1.5
func (d *DefaultDaemon) Registered() error
func (*DefaultDaemon) Start ¶ added in v1.1.0
func (d *DefaultDaemon) Start()
func (*DefaultDaemon) State ¶ added in v1.2.18
func (d *DefaultDaemon) State() int32
func (*DefaultDaemon) Stop ¶ added in v1.1.0
func (d *DefaultDaemon) Stop(sig os.Signal)
type DefaultSchedulerDaemon ¶ added in v1.3.0
type DefaultSchedulerDaemon struct {
DefaultDaemon
}
func (*DefaultSchedulerDaemon) Loop ¶ added in v1.3.0
func (d *DefaultSchedulerDaemon) Loop() error
func (*DefaultSchedulerDaemon) When ¶ added in v1.3.0
func (d *DefaultSchedulerDaemon) When() CronSyntax
type DefaultTimerDaemon ¶ added in v1.2.7
type DefaultTimerDaemon struct {
DefaultDaemon
}
func (*DefaultTimerDaemon) Interval ¶ added in v1.2.18
func (d *DefaultTimerDaemon) Interval() time.Duration
func (*DefaultTimerDaemon) Loop ¶ added in v1.2.7
func (d *DefaultTimerDaemon) Loop() error
type PanicResult ¶
type SchedulerDaemon ¶ added in v1.3.0
type SchedulerDaemon interface { Daemon Looper When() CronSyntax }
Click to show internal directories.
Click to hide internal directories.