eventhub

package
v0.0.0-...-5b4b2d5 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2021 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

View Source
const (
	PublishPolicyAll = iota
	PublishPolicyRoundRobin
	PublishPolicyRandom
)

Variables

View Source
var GlobalEventHub = &EventHub{Subscribers: cmap.New(), RoundRobinState: RoundRobinState{make(map[string]int)}}

Functions

This section is empty.

Types

type Event

type Event struct {
	Publisher *actor.PID
	Topic     string
	Message   interface{}
	Policy    PublishPolicy
}

type EventHub

type EventHub struct {
	//sync.RWMutex
	Subscribers cmap.ConcurrentMap
	RoundRobinState
}

func (*EventHub) Publish

func (this *EventHub) Publish(event *Event)

func (*EventHub) RemovePID

func (this *EventHub) RemovePID(pid actor.PID)

func (*EventHub) Subscribe

func (this *EventHub) Subscribe(topic string, subscriber *actor.PID)

func (*EventHub) Unsubscribe

func (this *EventHub) Unsubscribe(topic string, subscriber *actor.PID)

type PublishPolicy

type PublishPolicy int

type RoundRobinState

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

Jump to

Keyboard shortcuts

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