Documentation ¶
Overview ¶
Package session implements session objects to be used with MQTT clients.
Index ¶
- type Direction
- type MemorySession
- func (s *MemorySession) AllPackets(dir Direction) ([]packet.GenericPacket, error)
- func (s *MemorySession) AllSubscriptions() ([]*packet.Subscription, error)
- func (s *MemorySession) ClearWill() error
- func (s *MemorySession) DeletePacket(dir Direction, id packet.ID) error
- func (s *MemorySession) DeleteSubscription(topic string) error
- func (s *MemorySession) LookupPacket(dir Direction, id packet.ID) (packet.GenericPacket, error)
- func (s *MemorySession) LookupSubscription(topic string) (*packet.Subscription, error)
- func (s *MemorySession) LookupWill() (*packet.Message, error)
- func (s *MemorySession) NextID() packet.ID
- func (s *MemorySession) Reset() error
- func (s *MemorySession) SavePacket(dir Direction, pkt packet.GenericPacket) error
- func (s *MemorySession) SaveSubscription(sub *packet.Subscription) error
- func (s *MemorySession) SaveWill(newWill *packet.Message) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemorySession ¶
type MemorySession struct {
// contains filtered or unexported fields
}
A MemorySession stores packets in memory.
func NewMemorySession ¶
func NewMemorySession() *MemorySession
NewMemorySession returns a new MemorySession.
func (*MemorySession) AllPackets ¶
func (s *MemorySession) AllPackets(dir Direction) ([]packet.GenericPacket, error)
AllPackets will return all packets currently saved in the session.
func (*MemorySession) AllSubscriptions ¶
func (s *MemorySession) AllSubscriptions() ([]*packet.Subscription, error)
AllSubscriptions will return all subscriptions currently saved in the session.
func (*MemorySession) ClearWill ¶
func (s *MemorySession) ClearWill() error
ClearWill will remove the will message from the store.
func (*MemorySession) DeletePacket ¶
func (s *MemorySession) DeletePacket(dir Direction, id packet.ID) error
DeletePacket will remove a packet from the session. The method must not return an error if no packet with the specified id does exists.
func (*MemorySession) DeleteSubscription ¶
func (s *MemorySession) DeleteSubscription(topic string) error
DeleteSubscription will remove the subscription from the session. The method will not return an error if no subscription with the specified topic does exist.
func (*MemorySession) LookupPacket ¶
func (s *MemorySession) LookupPacket(dir Direction, id packet.ID) (packet.GenericPacket, error)
LookupPacket will retrieve a packet from the session using a packet id.
func (*MemorySession) LookupSubscription ¶
func (s *MemorySession) LookupSubscription(topic string) (*packet.Subscription, error)
LookupSubscription will match a topic against the stored subscriptions and eventually return the first found subscription.
func (*MemorySession) LookupWill ¶
func (s *MemorySession) LookupWill() (*packet.Message, error)
LookupWill will retrieve the will message.
func (*MemorySession) NextID ¶
func (s *MemorySession) NextID() packet.ID
NextID will return the next id for outgoing packets.
func (*MemorySession) Reset ¶
func (s *MemorySession) Reset() error
Reset will completely reset the session.
func (*MemorySession) SavePacket ¶
func (s *MemorySession) SavePacket(dir Direction, pkt packet.GenericPacket) error
SavePacket will store a packet in the session. An eventual existing packet with the same id gets quietly overwritten.
func (*MemorySession) SaveSubscription ¶
func (s *MemorySession) SaveSubscription(sub *packet.Subscription) error
SaveSubscription will store the subscription in the session. An eventual subscription with the same topic gets quietly overwritten.