service

package
v0.25.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// StartedEvent triggered when service has been started
	StartedEvent = events.New("service", "started")
	// StoppedEvent triggered when service has been stopped
	StoppedEvent = events.New("service", "stopped")
)

Functions

func AddError

func AddError(s *Info, err error)

func MarkStarted

func MarkStarted(s *Info)

func MarkStopped

func MarkStopped(s *Info)

Types

type Config

type Config struct {
	Name settings.String `key:",init" default:"Background" desc:"The name of the service."`
	// Slug is the unique identifier of the service, if not provided it will be generated from the name.
	Slug         settings.String   `key:",init" desc:"The slug of the service."`
	Description  settings.String   `key:",init" default:"xxx" desc:"The name of the service."`
	RetryOnError settings.Bool     `key:",init" default:"false" desc:"Retry the service in case of an error."`
	MaxRetries   settings.Int      `key:",init" default:"3" desc:"Maximum number of retries on error."`
	RetryBackoff settings.Duration `key:",init" default:"5s" desc:"Duration to wait before each retry."`
}

func (*Config) Blueprint

func (s *Config) Blueprint() (*settings.Blueprint, error)

type Info

type Info struct {
	// contains filtered or unexported fields
}

func NewInfo

func NewInfo(name string, addr *address.Address) *Info

func (*Info) Addr

func (s *Info) Addr() *address.Address

func (*Info) Errs

func (s *Info) Errs() map[time.Time]error

func (*Info) Failed

func (s *Info) Failed() bool

func (*Info) Name

func (s *Info) Name() string

func (*Info) Running

func (s *Info) Running() bool

func (*Info) StartedAt

func (s *Info) StartedAt() time.Time

func (*Info) StoppedAt

func (s *Info) StoppedAt() time.Time

func (*Info) Valid

func (s *Info) Valid() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL