badger

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hook

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

Hook is a persistent storage hook based using BadgerDB file store as a backend.

func (*Hook) Debugf

func (h *Hook) Debugf(m string, v ...interface{})

Debugf satisfies the badger interface for a debug logger.

func (*Hook) Errorf

func (h *Hook) Errorf(m string, v ...interface{})

Errorf satisfies the badger interface for an error logger.

func (*Hook) ID

func (h *Hook) ID() string

ID returns the id of the hook.

func (*Hook) Infof

func (h *Hook) Infof(m string, v ...interface{})

Infof satisfies the badger interface for an info logger.

func (*Hook) Init

func (h *Hook) Init(config any) error

Init initializes and connects to the badger instance.

func (*Hook) OnClientExpired

func (h *Hook) OnClientExpired(cl *mqtt.Client)

OnClientExpired deleted expired clients from the store.

func (*Hook) OnDisconnect

func (h *Hook) OnDisconnect(cl *mqtt.Client, _ error, expire bool)

OnDisconnect removes a client from the store if their session has expired.

func (*Hook) OnQosComplete

func (h *Hook) OnQosComplete(cl *mqtt.Client, pk packets.Packet)

OnQosComplete removes a resolved inflight message from the store.

func (*Hook) OnQosDropped

func (h *Hook) OnQosDropped(cl *mqtt.Client, pk packets.Packet)

OnQosDropped removes a dropped inflight message from the store.

func (*Hook) OnQosPublish

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

OnQosPublish adds or updates an inflight message in the store.

func (*Hook) OnRetainMessage

func (h *Hook) OnRetainMessage(cl *mqtt.Client, pk packets.Packet, r int64)

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

func (*Hook) OnRetainedExpired

func (h *Hook) OnRetainedExpired(filter string)

OnRetainedExpired deletes expired retained messages from the store.

func (*Hook) OnSessionEstablished

func (h *Hook) OnSessionEstablished(cl *mqtt.Client, pk packets.Packet)

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

func (*Hook) OnSubscribed

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

OnSubscribed adds one or more client subscriptions to the store.

func (*Hook) OnSysInfoTick

func (h *Hook) OnSysInfoTick(sys *system.Info)

OnSysInfoTick stores the latest system info in the store.

func (*Hook) OnUnsubscribed

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

OnUnsubscribed removes one or more client subscriptions from the store.

func (*Hook) OnWillSent

func (h *Hook) 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 (*Hook) Provides

func (h *Hook) Provides(b byte) bool

Provides indicates which hook methods this hook provides.

func (*Hook) Stop

func (h *Hook) Stop() error

Stop closes the badger instance.

func (*Hook) StoredClients

func (h *Hook) StoredClients() (v []storage.Client, err error)

StoredClients returns all stored clients from the store.

func (*Hook) StoredInflightMessages

func (h *Hook) StoredInflightMessages() (v []storage.Message, err error)

StoredInflightMessages returns all stored inflight messages from the store.

func (*Hook) StoredRetainedMessages

func (h *Hook) StoredRetainedMessages() (v []storage.Message, err error)

StoredRetainedMessages returns all stored retained messages from the store.

func (*Hook) StoredSubscriptions

func (h *Hook) StoredSubscriptions() (v []storage.Subscription, err error)

StoredSubscriptions returns all stored subscriptions from the store.

func (*Hook) StoredSysInfo

func (h *Hook) StoredSysInfo() (v storage.SystemInfo, err error)

StoredSysInfo returns the system info from the store.

func (*Hook) Warningf

func (h *Hook) Warningf(m string, v ...interface{})

Warningf satisfies the badger interface for a warning logger.

type Options

type Options struct {
	Options *badgerhold.Options
	Path    string
}

Options contains configuration settings for the BadgerDB instance.

Jump to

Keyboard shortcuts

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