mqttbroker

package
v0.0.0-...-68b20d9 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0, MIT Imports: 8 Imported by: 0

Documentation

Overview

******************************************************************************

  • Copyright 2017 Dell Inc.
  • Copyright (c) 2019 Intel Corporation *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

Index

Constants

This section is empty.

Variables

View Source
var (
	DbClient interfaces.DBClient
)

Functions

func GetDbClient

func GetDbClient() interfaces.DBClient

func MessageToPublish

func MessageToPublish(msg *Message, version packets.Version) *packets.Publish

MessageToPublish create the publish packet instance from *Message

Types

type Database

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

func NewDatabase

func NewDatabase(conf config.Config) Database

NewDatabase is a factory method that returns an initialized Database receiver struct.

func (Database) InitDBClient

func (d Database) InitDBClient(
	lc *zap.Logger) error

init the dbClient interfaces

type Message

type Message struct {
	Dup      bool
	QoS      uint8
	Retained bool
	Topic    string
	Payload  []byte
	PacketID packets.PacketID
	// The following fields are introduced in v5 specification.
	// Excepting MessageExpiry, these fields will not take effect when it represents a v3.x publish packet.
	ContentType            string
	CorrelationData        []byte
	MessageExpiry          uint32
	PayloadFormat          packets.PayloadFormat
	ResponseTopic          string
	SubscriptionIdentifier []uint32
	UserProperties         []packets.UserProperty
}

func MessageFromPublish

func MessageFromPublish(p *packets.Publish) *Message

MessageFromPublish create the Message instance from publish packets

func (*Message) Copy

func (m *Message) Copy() *Message

Copy deep copies the Message and return the new one

func (*Message) TotalBytes

func (m *Message) TotalBytes(version packets.Version) uint32

TotalBytes return the publish packets total bytes.

type Session

type Session struct {
	// ClientID represents the client id.
	ClientID string
	// Will is the will message of the client, can be nil if there is no will message.
	Will *Message
	// WillDelayInterval represents the Will Delay Interval in seconds
	WillDelayInterval uint32
	// ConnectedAt is the session create time.
	ConnectedAt time.Time
	// ExpiryInterval represents the Session Expiry Interval in seconds
	ExpiryInterval uint32
}

Session represents a MQTT session.

func (*Session) IsExpired

func (s *Session) IsExpired(now time.Time) bool

IsExpired return whether the session is expired

type Subscription

type Subscription struct {
	// ShareName is the share name of a shared subscription.
	// set to "" if it is a non-shared subscription.
	ShareName string
	// TopicFilter is the topic filter which does not include the share name.
	TopicFilter string
	// ID is the subscription identifier
	ID uint32

	// QoS is the qos level of the Subscription.
	QoS packets.QoS
	// NoLocal is the No Local option.
	NoLocal bool
	// RetainAsPublished is the Retain As Published option.
	RetainAsPublished bool
	// RetainHandling the Retain Handling option.
	RetainHandling byte
}

Subscription represents a subscription in mqttbroker.

func (*Subscription) Copy

func (s *Subscription) Copy() *Subscription

Copy makes a copy of subscription.

func (*Subscription) GetFullTopicName

func (s *Subscription) GetFullTopicName() string

GetFullTopicName returns the full topic name of the subscription.

func (*Subscription) Validate

func (s *Subscription) Validate() error

Validate returns whether the subscription is valid. If you can ensure the subscription is valid then just skip the validation.

Directories

Path Synopsis
Package config is a generated GoMock package.
Package config is a generated GoMock package.
infrastructure
sqlite
******************************************************************************
******************************************************************************
******************************************************************************
******************************************************************************
queue
Package queue is a generated GoMock package.
Package queue is a generated GoMock package.
session
Package session is a generated GoMock package.
Package session is a generated GoMock package.
subscription
Package subscription is a generated GoMock package.
Package subscription is a generated GoMock package.
unack
Package unack is a generated GoMock package.
Package unack is a generated GoMock package.
plugin
admin
Package admin is a reverse proxy.
Package admin is a reverse proxy.
aplugin/snowflake
Package snowflake provides a very simple Twitter snowflake generator and parser.
Package snowflake provides a very simple Twitter snowflake generator and parser.
auth
Package auth is a reverse proxy.
Package auth is a reverse proxy.
federation
Package federation is a reverse proxy.
Package federation is a reverse proxy.
Package retained is a generated GoMock package.
Package retained is a generated GoMock package.
Package server is a generated GoMock package.
Package server is a generated GoMock package.
topicalias

Jump to

Keyboard shortcuts

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