workers

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package workers contains code to manage workers.

A worker is a goroutine running in the background that performs some activity related to implementing the OpenVPN protocol.

Index

Constants

This section is empty.

Variables

View Source
var ErrShutdown = errors.New("worker is shutting down")

ErrShutdown is the error returned by a worker that is shutting down.

Functions

This section is empty.

Types

type Manager

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

Manager coordinates the lifeycles of the workers implementing the OpenVPN protocol. The zero value is invalid; use NewManager.

func NewManager

func NewManager(logger model.Logger) *Manager

NewManager creates a new *Manager.

func (*Manager) OnWorkerDone

func (m *Manager) OnWorkerDone(name string)

OnWorkerDone MUST be called when a worker goroutine terminates.

func (*Manager) ShouldShutdown

func (m *Manager) ShouldShutdown() <-chan any

ShouldShutdown returns the channel closed when workers should shut down.

func (*Manager) StartShutdown

func (m *Manager) StartShutdown()

StartShutdown initiates the shutdown of all workers.

func (*Manager) StartWorker

func (m *Manager) StartWorker(fx func())

StartWorker starts a worker in a background goroutine.

func (*Manager) WaitWorkersShutdown

func (m *Manager) WaitWorkersShutdown()

WaitWorkersShutdown blocks until all workers have shut down.

Jump to

Keyboard shortcuts

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