Documentation
¶
Index ¶
- Constants
- Variables
- func Register(newFc NewService, opts ...UnitOptions)
- func Run() error
- func Stop()
- func Wait()
- type Context
- type EnvManager
- type Kit
- type KitOptions
- type Logger
- type Namespace
- type NewService
- type Restart
- type Service
- type ServiceType
- type UnimplementedHandler
- type Unit
- type UnitOptions
- type Units
Constants ¶
View Source
const PublicNamespace = "__public_namespace__"
Variables ¶
View Source
var (
ErrQuitUnexpectedly = errors.New("quit unexpectedly")
)
View Source
var ServiceName string = "packaged-daemon"
Functions ¶
func Register ¶
func Register(newFc NewService, opts ...UnitOptions)
Register adds a new service to the internal service manager.
Types ¶
type EnvManager ¶
type EnvManager interface {
GetEnv(key string) (string, bool)
GetEnvInt(key string) (int, error)
GetEnvFloat(key string) (float64, error)
GetEnvBool(key string) (bool, error)
GetEnvTime(key string, layout string) (time.Time, error)
GetEnvDuration(key string) (time.Duration, error)
Assign(dest any) error
}
type Kit ¶
func New ¶
func New(opts ...KitOptions) *Kit
func (*Kit) Register ¶
func (k *Kit) Register(newFc NewService, opts ...UnitOptions)
type KitOptions ¶
type KitOptions func(*Kit)
func WithLogger ¶
func WithLogger(logger Logger) KitOptions
type NewService ¶
type Service ¶
type Service interface {
Name() string
Type() ServiceType
OnInstall() error
OnStart() error
OnStop() error
// contains filtered or unexported methods
}
type ServiceType ¶
type ServiceType int32
const ( ServiceTypeIgnore ServiceType = iota ServiceTypeBlocking ServiceTypeAsync )
type UnimplementedHandler ¶
type UnimplementedHandler struct{}
func (UnimplementedHandler) Name ¶
func (h UnimplementedHandler) Name() string
func (UnimplementedHandler) OnInstall ¶
func (h UnimplementedHandler) OnInstall() error
func (UnimplementedHandler) OnStart ¶
func (h UnimplementedHandler) OnStart() error
func (UnimplementedHandler) OnStop ¶
func (h UnimplementedHandler) OnStop() error
func (UnimplementedHandler) Type ¶
func (h UnimplementedHandler) Type() ServiceType
type UnitOptions ¶
type UnitOptions func(*Unit)
func WithDescription ¶
func WithDescription(desc string) UnitOptions
func WithIndex ¶
func WithIndex(idx int32) UnitOptions
func WithMaxRetry ¶
func WithMaxRetry(retry int32) UnitOptions
func WithNamespace ¶
func WithNamespace(ns string) UnitOptions
func WithRestartPolicy ¶
func WithRestartPolicy(rp Restart) UnitOptions
Click to show internal directories.
Click to hide internal directories.
