Documentation ¶
Index ¶
- Variables
- type Container
- func (c *Container) CanRetry() bool
- func (c *Container) Cancel(err error)
- func (c *Container) Done() <-chan struct{}
- func (c *Container) HandleEvent(sess *session.Context, ev events.Event)
- func (c *Container) HasTick() bool
- func (c *Container) Info() *service.Info
- func (c *Container) Listeners() []string
- func (c *Container) Register(sess *session.Context) error
- func (c *Container) Retries() int
- func (c *Container) Settings() service.Config
- func (c *Container) Start(ectx context.Context, sess *session.Context) (err error)
- func (c *Container) Stop(sess *session.Context, e error) (err error)
- func (c *Container) Tick(sess *session.Context, ts time.Time, delta time.Duration) error
- func (c *Container) Tock(sess *session.Context, delta time.Duration, tps int) error
- type CronScheduler
- type Info
- type Service
- func (s *Service) Cron(setupFunc func(schedule CronScheduler))
- func (s *Service) Name() string
- func (s *Service) OnAnyEvent(cb events.ActionWithEvent[*session.Context])
- func (s *Service) OnEvent(scope, key string, cb events.ActionWithEvent[*session.Context])
- func (s *Service) OnRegister(action action.Action)
- func (s *Service) OnStart(action action.Action)
- func (s *Service) OnStop(action action.WithPrevErr)
- func (s *Service) Slug() string
- func (s *Service) Tick(action action.Tick)
- func (s *Service) Tock(action action.Tock)
- type ServiceLoader
- type Settings
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Container ¶ added in v0.25.0
type Container struct {
// contains filtered or unexported fields
}
func NewContainer ¶ added in v0.25.0
func (*Container) HandleEvent ¶ added in v0.25.0
type CronScheduler ¶ added in v0.25.0
type Service ¶ added in v0.25.0
type Service struct {
// contains filtered or unexported fields
}
func New ¶ added in v0.25.0
New cretes new draft service which you can compose before passing it to applciation or providing it from addon.
func (*Service) Cron ¶ added in v0.25.0
func (s *Service) Cron(setupFunc func(schedule CronScheduler))
Cron scheduled cron jobs to run when the service is running.
func (*Service) OnAnyEvent ¶ added in v0.25.0
func (s *Service) OnAnyEvent(cb events.ActionWithEvent[*session.Context])
OnAnyEvent called when any event is received.
func (*Service) OnRegister ¶ added in v0.25.0
OnRegister is called when app is preparing runtime and attaching services, This does not mean that service will be used or started.
func (*Service) OnStart ¶ added in v0.25.0
OnStart is called when service is requested to be started. For instace when command is requiring this service or whenever service is required on runtime via sess.RequireService call.
Start can be called multiple times in case of service restarts. If you do not want to allow service restarts you should implement your logic in OnStop when it's called first time and check that state OnStart.
func (*Service) OnStop ¶ added in v0.25.0
func (s *Service) OnStop(action action.WithPrevErr)
OnStop is called when runtime request to stop the service is recieved.
type ServiceLoader ¶ added in v0.25.0
type ServiceLoader struct {
// contains filtered or unexported fields
}
func NewLoader ¶ added in v0.25.0
func NewLoader(sess *session.Context, svcs ...string) *ServiceLoader
NewServiceLoader creates new service loader which can be used to load services.
func (*ServiceLoader) Err ¶ added in v0.25.0
func (sl *ServiceLoader) Err() error
func (*ServiceLoader) Load ¶ added in v0.25.0
func (sl *ServiceLoader) Load() <-chan struct{}