msgbus

package
v0.0.0-...-6ba83c3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MsgBus

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

MsgBus is a 1-to-n event distribution.

func New

func New() *MsgBus

New create a new msgbus.

func (*MsgBus) Broadcast

func (m *MsgBus) Broadcast(id uint64, v interface{})

Broadcast sends event to subscribers.

func (*MsgBus) BroadcastToAll

func (m *MsgBus) BroadcastToAll(v interface{})

BroadcastToAll sends v to all events subscribers.

func (*MsgBus) Close

func (m *MsgBus) Close() error

Close msgbus and remove all subscription.

func (*MsgBus) Subscribe

func (m *MsgBus) Subscribe(id uint64) *Subscription

Subscribe creates an async subscription for event.

func (*MsgBus) SubscribeBuffered

func (m *MsgBus) SubscribeBuffered(id uint64, n int) *Subscription

SubscribeBuffered creates an async buffered subscription for event.

func (*MsgBus) SubscribeOnce

func (m *MsgBus) SubscribeOnce(id uint64) *Subscription

SubscribeOnce creates an async one time subscription for event.

type Subscription

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

Subscription represents interest in a given event.

func (*Subscription) Chan

func (s *Subscription) Chan() <-chan interface{}

Chan returns subscription channel.

func (*Subscription) Unsubscribe

func (s *Subscription) Unsubscribe()

Unsubscribe will remove interest in the given event.

Jump to

Keyboard shortcuts

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