Documentation
¶
Overview ¶
Package tools implements utilities for building MQTT 3.1.1 (http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/) components.
Index ¶
- type Conn
- type Counter
- type Flow
- func (f *Flow) Close() *Flow
- func (f *Flow) Delay(d time.Duration) *Flow
- func (f *Flow) End() *Flow
- func (f *Flow) Receive(pkt packet.Packet) *Flow
- func (f *Flow) Run(fn func()) *Flow
- func (f *Flow) Send(pkt packet.Packet) *Flow
- func (f *Flow) Skip() *Flow
- func (f *Flow) Test(t *testing.T, conn Conn)
- func (f *Flow) Wait(ch chan struct{}) *Flow
- type Pipe
- type Queue
- type Store
- type Tree
- func (t *Tree) Add(topic string, value interface{})
- func (t *Tree) All() []interface{}
- func (t *Tree) Clear(value interface{})
- func (t *Tree) Empty(topic string)
- func (t *Tree) Match(topic string) []interface{}
- func (t *Tree) MatchFirst(topic string) interface{}
- func (t *Tree) Remove(topic string, value interface{})
- func (t *Tree) Reset()
- func (t *Tree) Search(topic string) []interface{}
- func (t *Tree) SearchFirst(topic string) interface{}
- func (t *Tree) Set(topic string, value interface{})
- func (t *Tree) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶ added in v0.7.0
type Conn interface {
Send(pkt packet.Packet) error
Receive() (packet.Packet, error)
Close() error
}
A Conn defines an abstract interface for connections used with a Flow.
type Counter ¶ added in v0.6.0
type Counter struct {
// contains filtered or unexported fields
}
A Counter continuously counts packet ids.
type Flow ¶ added in v0.6.0
type Flow struct {
// contains filtered or unexported fields
}
A Flow is a sequence of actions that can be tested against a connection.
type Pipe ¶ added in v0.7.0
type Pipe struct {
// contains filtered or unexported fields
}
The Pipe pipes packets from Send to Receive.
func (*Pipe) Close ¶ added in v0.7.0
Close will close the conn and let Send and Receive return errors.
type Queue ¶ added in v0.7.0
type Queue struct {
// contains filtered or unexported fields
}
Queue is a basic FIFO queue for Messages.
func NewQueue ¶ added in v0.7.0
NewQueue returns a new Queue. If maxSize is greater than zero the queue will not grow more than the defined size.
type Store ¶ added in v0.6.0
type Store struct {
// contains filtered or unexported fields
}
The Store is a thread-safe packet store.
type Tree ¶
type Tree struct {
// The separator character. Default: "/"
Separator string
// The single level wildcard character. Default: "+"
WildcardOne string
// The multi level wildcard character. Default "#"
WildcardSome string
// contains filtered or unexported fields
}
A Tree implements a thread-safe topic tree.
func (*Tree) Add ¶
Add registers the value for the supplied topic. This function will automatically grow the tree. If value already exists for the given topic it will not be added again.
func (*Tree) All ¶ added in v0.4.0
func (t *Tree) All() []interface{}
All will return all stored values in the tree.
func (*Tree) Clear ¶
func (t *Tree) Clear(value interface{})
Clear will unregister the supplied value from all topics. This function will automatically shrink the tree.
func (*Tree) Empty ¶
Empty will unregister all values from the supplied topic. This function will automatically shrink the tree.
func (*Tree) Match ¶
Match will return a set of values from topics that match the supplied topic. The result set will be cleared from duplicate values.
Note: In contrast to Search, Match does not respect wildcards in the query but in the stored tree.
func (*Tree) MatchFirst ¶ added in v0.7.0
MatchFirst will run Match and return the first value or nil.
func (*Tree) Remove ¶
Remove unregisters the value from the supplied topic. This function will automatically shrink the tree.
func (*Tree) Search ¶ added in v0.3.0
Search will return a set of values from topics that match the supplied topic. The result set will be cleared from duplicate values.
Note: In contrast to Match, Search respects wildcards in the query but not in the stored tree.
func (*Tree) SearchFirst ¶ added in v0.7.0
SearchFirst will run Search and return the first value or nil.