controller

package
v0.0.0-...-b0bff92 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrControllerClosed = errors.New("controller closed")

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a manifold whose worker which wraps a *state.State, which is in turn wrapped by a Tracker. It will exit if the State's associated mongodb session dies.

Types

type ManifoldConfig

type ManifoldConfig struct {
	AgentName              string
	StateConfigWatcherName string
	OpenController         func(coreagent.Config) (*state.Controller, error)
	MongoPingInterval      time.Duration
}

ManifoldConfig provides the dependencies for Manifold.

type Tracker

type Tracker interface {
	// Use returns wrapped Controller, recording the use of
	// it. ErrControllerClosed is returned if the Controller is closed.
	Use() (*state.Controller, error)

	// Done records that there's one less user of the wrapped Controller,
	// closing it if there's no more users. ErrControllerClosed is returned
	// if the Controller has already been closed (indicating that Done has
	// called too many times).
	Done() error
}

Tracker describes a type which wraps and manages the lifetime of a *state.Controller.

Jump to

Keyboard shortcuts

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