topics

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QosAtMostOnce byte = iota
	QosAtLeastOnce
	QosExactlyOnce
	QosFailure = 0x80
)
View Source
const (
	// MWC is the multi-level wildcard
	MWC = "#"

	// SWC is the single level wildcard
	SWC = "+"

	// SEP is the topic level separator
	SEP = "/"

	// SYS is the starting character of the system level topics
	SYS = "$"
)

Variables

This section is empty.

Functions

func NewMemProvider

func NewMemProvider() *memTopics

NewMemProvider returns an new instance of the memTopics, which is implements the TopicsProvider interface. memProvider is a hidden struct that stores the topic subscriptions and retained messages in memory. The content is not persistend so when the server goes, everything will be gone. Use with care.

func Register

func Register(name string, provider TopicsProvider)

func Unregister

func Unregister(name string)

func ValidQos

func ValidQos(qos byte) bool

Types

type Manager

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

func NewManager

func NewManager(providerName string) (*Manager, error)

func (*Manager) Close

func (this *Manager) Close() error

func (*Manager) Retain

func (this *Manager) Retain(msg *packets.PublishPacket) error

func (*Manager) Retained

func (this *Manager) Retained(topic []byte, msgs *[]*packets.PublishPacket) error

func (*Manager) Subscribe

func (this *Manager) Subscribe(topic []byte, qos byte, subscriber interface{}) (byte, error)

func (*Manager) Subscribers

func (this *Manager) Subscribers(topic []byte, qos byte, subs *[]interface{}, qoss *[]byte) error

func (*Manager) Unsubscribe

func (this *Manager) Unsubscribe(topic []byte, subscriber interface{}) error

type TopicsProvider

type TopicsProvider interface {
	Subscribe(topic []byte, qos byte, subscriber interface{}) (byte, error)
	Unsubscribe(topic []byte, subscriber interface{}) error
	Subscribers(topic []byte, qos byte, subs *[]interface{}, qoss *[]byte) error
	Retain(msg *packets.PublishPacket) error
	Retained(topic []byte, msgs *[]*packets.PublishPacket) error
	Close() error
}

TopicsProvider

Jump to

Keyboard shortcuts

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