clean

package
v2.19.2 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package clean provides functionality to stop a list of services gracefully and synchronously.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cleaner

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

Cleaner can be used to stop a list of services gracefully. To register an arbitrary amount of stoppers either use New or With. Start needs to be called to ready the Cleaner, then Clean will activate it. Done can be used to wait for Cleaner to run all registered stoppers.

func New

func New(stoppers ...stopper) *Cleaner

New creates a new cleaner.

func (*Cleaner) Clean

func (c *Cleaner) Clean()

Clean initiates the cleanup but does not wait for it to complete.

func (*Cleaner) Done

func (c *Cleaner) Done()

Done waits for the cleanup to complete.

func (*Cleaner) Start

func (c *Cleaner) Start()

Start blocks until it receives a stop message, stops all services gracefully and returns.

func (*Cleaner) With

func (c *Cleaner) With(stopper stopper) *Cleaner

With adds a new stopper to the cleaner.

Jump to

Keyboard shortcuts

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