queue

package
v0.0.0-...-297abb6 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReturnItem

func ReturnItem(i *Item)

func ReturnItemQos12

func ReturnItemQos12(i *Item)

Types

type Basic

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

Inbound PUBLISH messages to server, as well as outbound QoS 0 to clients.

func (*Basic) Add

func (q *Basic) Add(i *Item)

func (*Basic) Init

func (q *Basic) Init()

func (*Basic) NotifyDispatcher

func (q *Basic) NotifyDispatcher()

NotifyDispatcher will signal dispatcher to check the queue.

func (*Basic) Reset

func (q *Basic) Reset()

func (*Basic) StartDispatcher

func (q *Basic) StartDispatcher(ctx context.Context, d func(*Item) error, wg *sync.WaitGroup)

StartDispatcher will continuously dispatch queue items and remove them.

type Item

type Item struct {
	Sent int64 // QoS 1&2, PUBREL

	P *model.PubMessage

	SId      uint32 // Subscription Id. PUBLISH from Server to Client.
	PId      uint16 // QoS 1&2, PUBREL
	TxQoS    uint8
	Retained bool // Msg sent to client due to subscription
	// contains filtered or unexported fields
}

Item is stored in various publish message queues.

func GetItem

func GetItem(p *model.PubMessage) (i *Item)

type QoS12

type QoS12 struct {
	Basic
	// contains filtered or unexported fields
}

Outbound QoS 1 & 2 PUBLISH messages to clients.

func (*QoS12) Add

func (q *QoS12) Add(i *Item)

func (*QoS12) Init

func (q *QoS12) Init()

func (*QoS12) MonitorTimeouts

func (q *QoS12) MonitorTimeouts(ctx context.Context, toS int64, d func(*Item) error, wg *sync.WaitGroup)

Resend pending/unacknowledged QoS 1 & 2 PUBLISHs after timeout.

func (*QoS12) Remove

func (q *QoS12) Remove(i *Item)

func (*QoS12) RemoveId

func (q *QoS12) RemoveId(id uint16) *Item

RemoveId finalized QoS 1 & 2 messages.

func (*QoS12) ResendAll

func (q *QoS12) ResendAll(d func(*Item) error) error

Resend all pending QoS 1 & 2 PUBLISHs for new session.

func (*QoS12) Reset

func (q *QoS12) Reset()

func (*QoS12) StartDispatcher

func (q *QoS12) StartDispatcher(ctx context.Context, d func(*Item) error, getPId func() uint16, wg *sync.WaitGroup)

StartDispatcher will continuously dispatch new, previously undispatched queue items. Doesn't remove them.

type QoS2Part2

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

Outbound PUBREL messages,

func (*QoS2Part2) Add

func (q *QoS2Part2) Add(i *Item)

Outbound QoS 2 PUBREL messages.

func (*QoS2Part2) Init

func (q *QoS2Part2) Init()

func (*QoS2Part2) MonitorTimeouts

func (q *QoS2Part2) MonitorTimeouts(ctx context.Context, toS int64, d func(*Item) error, wg *sync.WaitGroup)

Resend pending/unacknowledged QoS 2 PUBRELs after timeout.

func (*QoS2Part2) Present

func (q *QoS2Part2) Present(id uint16) bool

Present checks if QoS2 msg in stage 2 of transmission.

func (*QoS2Part2) Remove

func (q *QoS2Part2) Remove(id uint16) *Item

Remove PUBREL messages that were finalized.

func (*QoS2Part2) ResendAll

func (q *QoS2Part2) ResendAll(d func(*Item) error) error

Resend all pending QoS 2 PUBRELs for new session.

func (*QoS2Part2) Reset

func (q *QoS2Part2) Reset()

Jump to

Keyboard shortcuts

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