Documentation
¶
Overview ¶
Package service provides service primitives.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackgroundService ¶
type BackgroundService interface {
// Name returns the service name.
Name() string
// Start starts the service.
Start() error
// Stop halts the service.
Stop()
// Quit returns a channel that will be closed when the service terminates.
Quit() <-chan struct{}
CleanupAble
}
BackgroundService is a background service.
func NewCleanupOnlyService ¶
func NewCleanupOnlyService(svc CleanupAble, name string) BackgroundService
NewCleanupOnlyService wraps a service as a cleanup only service.
type BaseBackgroundService ¶
type BaseBackgroundService struct {
Logger *logging.Logger
// contains filtered or unexported fields
}
BaseBackgroundService is a base implementation of BackgroundService.
func NewBaseBackgroundService ¶
func NewBaseBackgroundService(name string) *BaseBackgroundService
NewBaseBackgroundService creates a new base background service implementation.
func (*BaseBackgroundService) Cleanup ¶
func (b *BaseBackgroundService) Cleanup()
Cleanup performs the service specific post-termination cleanup.
func (*BaseBackgroundService) Name ¶
func (b *BaseBackgroundService) Name() string
Name returns the service name.
func (*BaseBackgroundService) Quit ¶
func (b *BaseBackgroundService) Quit() <-chan struct{}
Quit returns a channel that will be closed when the service terminates.
func (*BaseBackgroundService) Start ¶
func (b *BaseBackgroundService) Start() error
Start starts the service.
type CleanupAble ¶
type CleanupAble interface {
// Cleanup performs the service specific post-termination cleanup.
Cleanup()
}
CleanupAble provides a Cleanup method.
func NewContextCleanup ¶
func NewContextCleanup(parent context.Context) (context.Context, CleanupAble)
NewContextCleanup makes a context and a CleanupAble that cancels it.
Click to show internal directories.
Click to hide internal directories.