subqueue

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package subqueue is internal implementation of awsiotdev package. It implements offline queueing of MQTT subscription.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OperationType

type OperationType int32

OperationType represents type of the operation.

const (
	// Subscribe requests a new subscription.
	Subscribe OperationType = iota
	// Unsubscribe requests stopping the subscription.
	Unsubscribe
)

type Queue

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

Queue manages queued subscription operations.

func New

func New() *Queue

New returns a queue of subscription operations.

func (*Queue) Enqueue

func (s *Queue) Enqueue(d *Subscription)

Enqueue pushes a subscription operation to the queue.

func (*Queue) Len

func (s *Queue) Len() int

Len returns the number of messages in the queue.

func (*Queue) Pop

func (s *Queue) Pop() *Subscription

Pop gets the oldest subscription operation in the queue and drops it.

type Subscription

type Subscription struct {
	Type  OperationType
	Topic string
	Cb    mqtt.MessageHandler
}

Subscription stores a request of subscription operation.

Jump to

Keyboard shortcuts

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