persistence

package
v0.0.0-...-ff68fb7 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PacketReserved byte = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BadgerProvider

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

func (*BadgerProvider) CheckForPacketIdReuse

func (b *BadgerProvider) CheckForPacketIdReuse(clientID string, packetID uint16) (bool, error)

func (*BadgerProvider) FreePacketID

func (b *BadgerProvider) FreePacketID(clientID string, packetID uint16) error

func (*BadgerProvider) GetMissedMessages

func (b *BadgerProvider) GetMissedMessages(clientID string) ([]*packets.Publish, error)

func (*BadgerProvider) ReservePacketID

func (b *BadgerProvider) ReservePacketID(clientID string, packetID uint16) error

func (*BadgerProvider) SaveForOfflineDelivery

func (b *BadgerProvider) SaveForOfflineDelivery(clientId string, publish *packets.Publish) error

type Provider

type Provider interface {
	SaveForOfflineDelivery(clientId string, publish *packets.Publish) error
	GetMissedMessages(clientId string) ([]*packets.Publish, error)

	ReservePacketID(clientID string, packetID uint16) error
	FreePacketID(clientID string, packetID uint16) error
	CheckForPacketIdReuse(clientID string, packetID uint16) (bool, error)
}

func NewBadgerProvider

func NewBadgerProvider(config *config.Config, logger *zap.Logger) (Provider, error)

func NewRedisProvider

func NewRedisProvider(config *config.Config, logger *zap.Logger) (Provider, error)

type RedisProvider

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

func (*RedisProvider) CheckForPacketIdReuse

func (r *RedisProvider) CheckForPacketIdReuse(clientID string, packetID uint16) (bool, error)

func (*RedisProvider) FreePacketID

func (r *RedisProvider) FreePacketID(clientID string, packetID uint16) error

func (*RedisProvider) GetMissedMessages

func (r *RedisProvider) GetMissedMessages(clientId string) ([]*packets.Publish, error)

func (*RedisProvider) ReservePacketID

func (r *RedisProvider) ReservePacketID(clientID string, packetID uint16) error

func (*RedisProvider) SaveForOfflineDelivery

func (r *RedisProvider) SaveForOfflineDelivery(clientId string, publish *packets.Publish) error

Jump to

Keyboard shortcuts

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