redis

package
v2.5.4 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	HPrefix string `json:"prefix" yaml:"prefix"`
	Options *redis.Options
}

Options contains configuration settings for the bolt instance.

type Storage

type Storage struct {
	mqtt.HookBase
	// contains filtered or unexported fields
}

Storage is a persistent storage hook based using Redis as a backend.

func (*Storage) ID

func (s *Storage) ID() string

ID returns the id of the hook.

func (*Storage) Init

func (s *Storage) Init(config any) error

Init initializes and connects to the redis service.

func (*Storage) OnClientExpired

func (s *Storage) OnClientExpired(cl *mqtt.Client)

OnClientExpired deleted expired clients from the store.

func (*Storage) OnDisconnect

func (s *Storage) OnDisconnect(cl *mqtt.Client, _ error, expire bool)

OnDisconnect removes a client from the store if they were using a clean session.

func (*Storage) OnQosComplete

func (s *Storage) OnQosComplete(cl *mqtt.Client, pk packets.Packet)

OnQosComplete removes a resolved inflight message from the store.

func (*Storage) OnQosDropped

func (s *Storage) OnQosDropped(cl *mqtt.Client, pk packets.Packet)

OnQosDropped removes a dropped inflight message from the store.

func (*Storage) OnQosPublish

func (s *Storage) OnQosPublish(cl *mqtt.Client, pk packets.Packet, sent int64, resends int)

OnQosPublish adds or updates an inflight message in the store.

func (*Storage) OnRetainMessage

func (s *Storage) OnRetainMessage(cl *mqtt.Client, pk packets.Packet, r int64)

OnRetainMessage adds a retained message for a topic to the store.

func (*Storage) OnRetainedExpired

func (s *Storage) OnRetainedExpired(filter string)

OnRetainedExpired deletes expired retained messages from the store.

func (*Storage) OnSessionEstablished

func (s *Storage) OnSessionEstablished(cl *mqtt.Client, pk packets.Packet)

OnSessionEstablished adds a client to the store when their session is established.

func (*Storage) OnSubscribed

func (s *Storage) OnSubscribed(cl *mqtt.Client, pk packets.Packet, reasonCodes []byte, counts []int)

OnSubscribed adds one or more client subscriptions to the store.

func (*Storage) OnSysInfoTick

func (s *Storage) OnSysInfoTick(sys *system.Info)

OnSysInfoTick stores the latest system info in the store.

func (*Storage) OnUnsubscribed

func (s *Storage) OnUnsubscribed(cl *mqtt.Client, pk packets.Packet, reasonCodes []byte, counts []int)

OnUnsubscribed removes one or more client subscriptions from the store.

func (*Storage) OnWillSent

func (s *Storage) OnWillSent(cl *mqtt.Client, pk packets.Packet)

OnWillSent is called when a client sends a will message and the will message is removed from the client record.

func (*Storage) Provides

func (s *Storage) Provides(b byte) bool

Provides indicates which hook methods this hook provides.

func (*Storage) Stop

func (s *Storage) Stop() error

Stop closes the redis connection.

func (*Storage) StoredClientByCid

func (s *Storage) StoredClientByCid(cid string) (v storage.Client, err error)

StoredClientByCid returns a stored client from the store.

func (*Storage) StoredInflightMessagesByCid

func (s *Storage) StoredInflightMessagesByCid(cid string) (v []storage.Message, err error)

StoredInflightMessagesByCid returns all stored inflight messages of client from the store.

func (*Storage) StoredRetainedMessageByTopic

func (s *Storage) StoredRetainedMessageByTopic(topic string) (v storage.Message, err error)

StoredRetainedMessageByTopic returns a stored retained message of topic from the store.

func (*Storage) StoredSubscriptionsByCid

func (s *Storage) StoredSubscriptionsByCid(cid string) (v []storage.Subscription, err error)

StoredSubscriptionsByCid returns all stored subscriptions of client from the store.

func (*Storage) StoredSysInfo

func (s *Storage) StoredSysInfo() (v storage.SystemInfo, err error)

StoredSysInfo returns the system info from the store.

Jump to

Keyboard shortcuts

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