Documentation
¶
Index ¶
- type Bus
- func (b *Bus) AddController(ctx context.Context, ctrl controller.Controller, cb func(exitErr error)) (func(), error)
- func (b *Bus) Close() error
- func (b *Bus) ExecuteController(ctx context.Context, c controller.Controller) error
- func (b *Bus) GetControllers() []controller.Controller
- func (b *Bus) GetControllersBroadcast() *broadcast.Broadcast
- func (b *Bus) RemoveController(c controller.Controller)
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 NewBusWithLogger ¶ added in v0.53.5
func NewBusWithLogger(dc directive.Controller, le *logrus.Entry) *Bus
NewBusWithLogger constructs a new in-memory Bus with a directive controller and lifecycle logger.
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 attaches a controller and calls Execute asynchronously. Its release function cancels, detaches, waits for Execute, closes once, and reports the lifecycle result through cb before returning.
func (*Bus) Close ¶ added in v0.53.5
Close rejects admission and joins every retained controller lifetime.
func (*Bus) ExecuteController ¶
func (b *Bus) ExecuteController(ctx context.Context, c controller.Controller) error
ExecuteController attaches a controller and calls Execute synchronously. A nil return leaves the controller attached for RemoveController. A terminal failure finalizes the attachment before returning.
func (*Bus) GetControllers ¶
func (b *Bus) GetControllers() []controller.Controller
GetControllers returns a list of all currently active controllers.
func (*Bus) GetControllersBroadcast ¶ added in v0.53.1
GetControllersBroadcast returns the broadcast that is signaled when controllers are added or removed from the bus.
func (*Bus) RemoveController ¶
func (b *Bus) RemoveController(c controller.Controller)
RemoveController synchronously finalizes one attached controller instance.