Versions in this module Expand all Collapse all v4 v4.0.4 Mar 4, 2022 v4.0.3 Mar 3, 2022 Changes in this version + var ErrDoNotRestart = errors.New("service should not be restarted") + var ErrSupervisorNotRunning = errors.New("supervisor not running") + var ErrSupervisorNotStarted = errors.New("supervisor not started yet") + var ErrSupervisorNotTerminated = errors.New("supervisor not terminated") + var ErrTerminateSupervisorTree = errors.New("tree should be terminated") + var ErrTimeout = errors.New("waiting for service to stop has timed out") + var ErrWrongSupervisor = errors.New("wrong supervisor for this service token, no service removed") + type DefaultJitter struct + func (dj *DefaultJitter) Jitter(d time.Duration) time.Duration + type DeprecatedService interface + Serve func() + Stop func() + type Event interface + Map func() map[string]interface{} + Type func() EventType + type EventBackoff struct + Supervisor *Supervisor + SupervisorName string + func (e EventBackoff) Map() map[string]interface{} + func (e EventBackoff) String() string + func (e EventBackoff) Type() EventType + type EventHook func(Event) + type EventResume struct + Supervisor *Supervisor + SupervisorName string + func (e EventResume) Map() map[string]interface{} + func (e EventResume) String() string + func (e EventResume) Type() EventType + type EventServicePanic struct + CurrentFailures float64 + FailureThreshold float64 + PanicMsg string + Restarting bool + Service Service + ServiceName string + Stacktrace string + Supervisor *Supervisor + SupervisorName string + func (e EventServicePanic) Map() map[string]interface{} + func (e EventServicePanic) String() string + func (e EventServicePanic) Type() EventType + type EventServiceTerminate struct + CurrentFailures float64 + Err interface{} + FailureThreshold float64 + Restarting bool + Service Service + ServiceName string + Supervisor *Supervisor + SupervisorName string + func (e EventServiceTerminate) Map() map[string]interface{} + func (e EventServiceTerminate) String() string + func (e EventServiceTerminate) Type() EventType + type EventStopTimeout struct + Service Service + ServiceName string + Supervisor *Supervisor + SupervisorName string + func (e EventStopTimeout) Map() map[string]interface{} + func (e EventStopTimeout) String() string + func (e EventStopTimeout) Type() EventType + type EventType int + const EventTypeBackoff + const EventTypeResume + const EventTypeServicePanic + const EventTypeServiceTerminate + const EventTypeStopTimeout + type HasSupervisor interface + GetSupervisor func() *Supervisor + type Jitter interface + Jitter func(time.Duration) time.Duration + type NoJitter struct + func (NoJitter) Jitter(d time.Duration) time.Duration + type Service interface + Serve func(ctx context.Context) error + func AsService(service DeprecatedService) Service + type ServiceToken struct + type Spec struct + BackoffJitter Jitter + DontPropagateTermination bool + EventHook EventHook + FailureBackoff time.Duration + FailureDecay float64 + FailureThreshold float64 + PassThroughPanics bool + Sprint SprintFunc + Timeout time.Duration + type SprintFunc func(interface{}) string + type Supervisor struct + Name string + func New(name string, spec Spec) *Supervisor + func NewSimple(name string) *Supervisor + func (s *Supervisor) Add(service Service) ServiceToken + func (s *Supervisor) GetSupervisor() *Supervisor + func (s *Supervisor) Remove(id ServiceToken) error + func (s *Supervisor) RemoveAndWait(id ServiceToken, timeout time.Duration) error + func (s *Supervisor) Serve(ctx context.Context) error + func (s *Supervisor) ServeBackground(ctx context.Context) <-chan error + func (s *Supervisor) Services() []Service + func (s *Supervisor) String() string + func (s *Supervisor) UnstoppedServiceReport() (UnstoppedServiceReport, error) + type UnstoppedService struct + Name string + Service Service + ServiceToken ServiceToken + SupervisorPath []*Supervisor + type UnstoppedServiceReport []UnstoppedService Other modules containing this package gitee.com/pengdacn/suture