inmem

package
v0.44.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus

type Bus struct {
	// Controller is the directive controller.
	directive.Controller
	// contains filtered or unexported fields
}

Bus is an in-memory controller bus.

func NewBus

func NewBus(dc directive.Controller) *Bus

NewBus constructs a new in-memory Bus with a directive controller.

func (*Bus) AddController added in v0.16.0

func (b *Bus) AddController(ctx context.Context, ctrl controller.Controller, cb func(exitErr error)) (func(), error)

AddController adds a controller to the bus and calls Execute(). Returns a release function for the controller instance. Any fatal error in the controller is written to the callback. The controller will receive directive callbacks until removed. cb can be nil

func (*Bus) ExecuteController

func (b *Bus) ExecuteController(ctx context.Context, c controller.Controller) (err error)

ExecuteController adds a controller to the bus and calls Execute(). Any fatal error in the controller is returned. The controller will receive directive callbacks. If the controller returns nil, call RemoveController to remove the controller.

func (*Bus) GetControllers

func (b *Bus) GetControllers() []controller.Controller

GetControllers returns a list of all currently active controllers.

func (*Bus) RemoveController

func (b *Bus) RemoveController(c controller.Controller)

RemoveController removes the controller from the bus.

Jump to

Keyboard shortcuts

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