Documentation
¶
Index ¶
- type Index
- func (x *Index) Messages(filter string) []packets.Packet
- func (x *Index) RetainMessage(msg packets.Packet) int64
- func (x *Index) Subscribe(filter, client string, qos byte) (bool, int)
- func (x *Index) Subscribers(topic string) Subscriptions
- func (x *Index) Unsubscribe(filter, client string) (bool, int)
- type Leaf
- type Subscriptions
Constants ¶
This section is empty.
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 (*Index) RetainMessage ¶
RetainMessage saves a message payload to the end of a topic branch. Returns 1 if a retained message was added, 0 if there was no change, and -1 if the retained message was removed.
func (*Index) Subscribe ¶
Subscribe creates a subscription filter for a client. Returns true if the subscription was new.
func (*Index) Subscribers ¶
func (x *Index) Subscribers(topic string) Subscriptions
Subscribers returns a map of clients who are subscribed to matching filters.
type Leaf ¶
type Leaf struct {
Message packets.Packet // a message which has been retained for a specific topic.
Key string // the key that was used to create the leaf.
Filter string // the path of the topic filter being matched.
Parent *Leaf // a pointer to the parent node for the leaf.
Leaves map[string]*Leaf // a map of child nodes, keyed on particle id.
Clients map[string]byte // a map of client ids subscribed to the topic.
}
Leaf is a child node on the tree.
type Subscriptions ¶
Subscriptions is a map of subscriptions keyed on client.
Click to show internal directories.
Click to hide internal directories.