pubsub

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseDiscover

func ParseDiscover(msg *Message) (bool, bool)

func ParseError

func ParseError(msg *Message) (error, bool)

func ParseStaleRadios

func ParseStaleRadios(msg *Message) bool

func PublishDiscover

func PublishDiscover(p Pub, discovering bool)

func PublishError

func PublishError(p Pub, err error)

func PublishStaleRadios

func PublishStaleRadios(p Pub)

func PublishStaleStateHook

func PublishStaleStateHook(p Pub, data StaleStateHookMessage)

func PublishState

func PublishState(p Pub, msg MessageState)

Types

type MemPub

type MemPub struct {
	// contains filtered or unexported fields
}
var DefaultPub *MemPub = NewMemPub()

func NewMemPub

func NewMemPub() *MemPub

func (*MemPub) Resubscribe

func (mp *MemPub) Resubscribe(topics []Topic, sub MemSub, unsub func()) func()

func (*MemPub) Stats

func (mp *MemPub) Stats() []MemPubStat

func (*MemPub) Subscribe

func (mp *MemPub) Subscribe(topics []Topic) (MemSub, func())

func (*MemPub) SubscribeWithBuffer

func (mp *MemPub) SubscribeWithBuffer(topics []Topic, buffer int) (MemSub, func())

type MemPubStat

type MemPubStat struct {
	Topic    Topic
	SubCount int
}

type MemSub

type MemSub struct {
	Message  chan Message
	Overflow chan struct{}
}

type Message

type Message struct {
	Topic Topic
	Data  interface{}
}

type MessageState

type MessageState struct {
	State   state.State
	Changed state.Changed
}

func ParseState

func ParseState(msg *Message) (MessageState, bool)

type Pub

type Pub interface {
	// contains filtered or unexported methods
}

type Stale

type Stale = string
const StalePresets Stale = "presets"
const StaleRadios Stale = "radios"

type StaleStateHookMessage

type StaleStateHookMessage struct {
	Changed state.Changed
}

func ParseStaleStateHook

func ParseStaleStateHook(msg *Message) (StaleStateHookMessage, bool)

type Topic

type Topic string
const TopicDiscover Topic = "discover"
const TopicError Topic = "error"
const TopicStale Topic = "stale"
const TopicStaleRadios Topic = "stale.radios"
const TopicStaleStateHook Topic = "stale.state.hook"
const TopicState Topic = "state"

func (Topic) In

func (t Topic) In(topics []Topic) bool

Jump to

Keyboard shortcuts

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