service

package
v0.2010.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2020 License: Apache-2.0 Imports: 2 Imported by: 1

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.

func (*BaseBackgroundService) Stop

func (b *BaseBackgroundService) Stop()

Stop halts 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.

Jump to

Keyboard shortcuts

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