strand

package
v0.0.0-...-d29d52d Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Debug enables debug logging
	Debug = false
)

Functions

func Strand

func Strand(logger *logging.Logger, c chan Request, name string, f func() error, quit chan struct{}, quitErr error) error

Strand linearizes concurrent method calls through a single channel, to avoid concurrency issues when conflicting methods are called from multiple goroutines. Methods passed to Strand() will block until completed. Strand accepts a quit channel and will return quitErr if the quit channel closes.

Types

type Request

type Request struct {
	Name string
	Func func() error
}

Request is sent to the channel provided to Strand

Jump to

Keyboard shortcuts

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