router

package
v0.0.0-...-53e3d08 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NopSinkSub

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

NopSinkSub subscription of sink which does nothing

func NewNopSinkSub

func NewNopSinkSub(id string, qos uint32, topic string, tqos uint32, ttopic string) *NopSinkSub

NewNopSinkSub creates a new subscription of sink which does nothing

func (*NopSinkSub) Flow

func (s *NopSinkSub) Flow(common.Message)

Flow flows message to channel

func (*NopSinkSub) ID

func (s *NopSinkSub) ID() string

ID returns the id of subscription

func (*NopSinkSub) QOS

func (s *NopSinkSub) QOS() uint32

QOS returns the qos of subscription

func (*NopSinkSub) TargetQOS

func (s *NopSinkSub) TargetQOS() uint32

TargetQOS returns the publish qos

func (*NopSinkSub) TargetTopic

func (s *NopSinkSub) TargetTopic() string

TargetTopic returns the publish topic

func (*NopSinkSub) Topic

func (s *NopSinkSub) Topic() string

Topic returns the topic of subscribed topic

type SinkSub

type SinkSub interface {
	ID() string // client id for session
	QOS() uint32
	Topic() string
	TargetQOS() uint32
	TargetTopic() string
	Flow(common.Message)
}

SinkSub subscription of sink

type Trie

type Trie struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Trie topic tree of *common.SinkSubs

func NewTrie

func NewTrie() *Trie

NewTrie creates a trie

func (*Trie) Add

func (t *Trie) Add(sub SinkSub)

Add adds subscription to trie #、+、/

func (*Trie) IsMatch

func (t *Trie) IsMatch(topic string) (bool, uint32)

IsMatch IsMatch TODO: improve

func (*Trie) Match

func (t *Trie) Match(topic string) []SinkSub

Match Matches topic

func (*Trie) MatchUnique

func (t *Trie) MatchUnique(topic string) map[string]SinkSub

MatchUnique matches subscriptions merged by id TODO: improve

func (*Trie) Remove

func (t *Trie) Remove(id, topic string)

Remove removes subscription to trie #、+、/

func (*Trie) RemoveAll

func (t *Trie) RemoveAll(id string)

RemoveAll removes all subscriptions by id

Jump to

Keyboard shortcuts

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