stopqueue

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package stopqueue contains a structure for running stop functions in a specific order

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

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

Queue is a stack of stop functions that executes in LIFO order

func NewStopQueue

func NewStopQueue() *Queue

NewStopQueue creates a new stop queue

func (*Queue) Add

func (s *Queue) Add(stopFunc StopFunc)

Add appends the stop func onto the queue

func (*Queue) StopAll

func (s *Queue) StopAll(ctx context.Context) error

StopAll runs all stop funcs and clears queue. Returns all errors encountered

type StopFunc

type StopFunc func(context.Context) error

StopFunc is a function that defines how to stop

Jump to

Keyboard shortcuts

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