lifecycle

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lifecycle

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

Lifecycle implements the lifecycle of a service, i.e. Start and Stop.

func New

func New(name string, opts ...Opt) *Lifecycle

New returns a new Lifecycle.

func (*Lifecycle) Start

func (h *Lifecycle) Start()

Start starts the service.

func (*Lifecycle) State

func (h *Lifecycle) State() spi.State

State returns the state of the service.

func (*Lifecycle) Stop

func (h *Lifecycle) Stop()

Stop stops the service.

type Opt

type Opt func(opts *options)

Opt sets a Lifecycle option.

func WithStart

func WithStart(start func()) Opt

WithStart sets the start function which is invoked when Start() is called.

func WithStop

func WithStop(stop func()) Opt

WithStop sets the stop function which is invoked when Stop() is called.

Jump to

Keyboard shortcuts

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