startstop

package module
v0.59.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 1 Imported by: 2

Documentation

Overview

Package startstop provides useful functionality for starting and stopping agent components.

The Startable and Stoppable interfaces define components that can be started and stopped, respectively. The package then provides utility functionality to start and stop components either concurrently or in series.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StartStoppable

type StartStoppable interface {
	Startable
	Stoppable
}

StartStoppable represents a startable and stopable object

type Startable

type Startable interface {
	Start()
}

Startable represents a startable object

type Starter

type Starter interface {
	Startable
	Add(components ...Startable)
}

Starter starts a group of startable objects from a data pipeline

func NewStarter

func NewStarter(components ...Startable) Starter

NewStarter returns a new serial starter.

The Start() method of this object will start all components, one by one, in the order they were added.

Any components included in the arguments will be included in the set of components, as if starter.Add(..) had been called for each.

type Stoppable

type Stoppable interface {
	Stop()
}

Stoppable represents a stoppable object

type Stopper

type Stopper interface {
	Stoppable
	Add(components ...Stoppable)
}

Stopper stops a group of stoppable objects from a data pipeline

func NewParallelStopper

func NewParallelStopper(components ...Stoppable) Stopper

NewParallelStopper returns a new parallel stopper.

The Stop() method of this object will stop all components concurrently, calling each component's Stop method in a dedicated goroutine. It will return only when all Stop calls have completed.

Any components included in the arguments will be included in the set of components, as if stopper.Add(..) had been called for each.

func NewSerialStopper

func NewSerialStopper(components ...Stoppable) Stopper

NewSerialStopper returns a new serial stopper.

The Stop() method of this object will stop all components, one by one, in the order they were added.

Any components included in the arguments will be included in the set of components, as if stopper.Add(..) had been called for each.

Jump to

Keyboard shortcuts

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