bus

package
v0.0.0-...-6312dd6 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: MIT Imports: 5 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 interface {
	BusController
	BusSubscriber
	BusPublisher
}

ThingsBus englobes global (subscribe, publish, control) bus behavior

func New

func New() Bus

New returns new eventBus with empty handlers.

type BusController

type BusController interface {
	HasCallback(topic string) bool
	WaitAsync()
}

BusController defines bus control behavior (checking handler's presence, synchronization)

type BusPublisher

type BusPublisher interface {
	Publish(topic string, args ...interface{})
}

BusPublisher defines publishing-related bus behavior

type BusSubscriber

type BusSubscriber interface {
	Subscribe(topic string, fn interface{}) error
	SubscribeAsync(topic string, fn interface{}, transactional bool) error
	SubscribeOnce(topic string, fn interface{}) error
	SubscribeOnceAsync(topic string, fn interface{}) error
	Unsubscribe(topic string, handler interface{}) error
}

BusSubscriber defines subscription-related bus behavior

type EventBus

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

func NewBus

func NewBus() *EventBus

func (*EventBus) Publish

func (t *EventBus) Publish(topic topic.Topic, args ...any)

func (*EventBus) Subscribe

func (t *EventBus) Subscribe(topic topic.Topic, fn any) error

func (*EventBus) Unsubscribe

func (t *EventBus) Unsubscribe(topic topic.Topic, f any)

type Publisher

type Publisher interface {
	Publish(topic2 topic.Topic, args ...any)
}

type Subscriber

type Subscriber interface {
	Subscribe(topic2 topic.Topic, f any) error
	Unsubscribe(topic2 topic.Topic, f any)
}

type ThingsBus

type ThingsBus interface {
	Publisher
	Subscriber
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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