topics

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SharePrefix = "$share/" // The lower prefix of the shared topic
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

type Index struct {
	Root *Leaf // a leaf containing a message and more leaves.
	// contains filtered or unexported fields
}

Index is a prefix/trie tree containing topic subscribers and retained messages.

func New

func New() *Index

New returns a pointer to a new instance of Index.

func (*Index) Scan

func (x *Index) Scan(topic string, filters []string) []string

Scan returns true if a matching filter exists

func (*Index) Subscribe

func (x *Index) Subscribe(filter string) bool

Subscribe creates a subscription filter for a client. Returns true if the subscription was new.

func (*Index) Unsubscribe

func (x *Index) Unsubscribe(filter string) bool

Unsubscribe removes a subscription filter for a client. Returns true if an unsubscribe action successful and the subscription existed.

type Leaf

type Leaf struct {
	Key          string           // the key that was used to create the leaf.
	Parent       *Leaf            // a pointer to the parent node for the leaf.
	Leaves       map[string]*Leaf // a map of child nodes, keyed on particle id.
	Filter       string           // the path of the topic filter being matched.
	Count        int              // the number of nodes subscribed to the topic.
	SharedGroups []string         // the shared topics of this leaf.
}

Leaf is a child node on the tree.

type Subscriptions

type Subscriptions map[string]byte

Subscriptions is a map of subscriptions keyed on client.

Jump to

Keyboard shortcuts

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