group

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package group provides a simple interface to manage go routines.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnimplemented = errors.New("server: unimplemented")

ErrUnimplemented is returned when a listener is not implemented.

Functions

This section is empty.

Types

type Error

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

Error ...

func Append

func Append(err error, errs ...error) *Error

Append ...

func (*Error) Error

func (e *Error) Error() string

Error ...

type Run

type Run struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Run is an abstraction on WaitGroup to run multiple functions concurrently. It mimics 'errgroup' to extend structs with functions to run concurrently with a root context.

func WithContext added in v0.5.8

func WithContext(ctx context.Context) (*Run, context.Context)

WithContext is creating a new group with a context.

func (*Run) Run

func (g *Run) Run(f RunFunc) error

Run is creating a new go routine to run a function concurrently.

func (*Run) SetLimit added in v0.5.8

func (g *Run) SetLimit(n int)

SetLimit limits the number of active listeners in this server

func (*Run) Shutdown added in v0.5.8

func (g *Run) Shutdown() error

Shutdown is waiting for all go routines to finish.

func (*Run) Wait

func (g *Run) Wait()

Wait is waiting for all go routines to finish.

type RunFunc added in v0.5.8

type RunFunc func(context.Context)

RunFunc is a function that is called to attach more routines to the server.

type Unimplemented added in v0.5.8

type Unimplemented struct{}

Unimplemented is the default implementation.

func (*Unimplemented) Run added in v0.5.8

Run is running a new go routine

Jump to

Keyboard shortcuts

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