redis

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodecJSON byte = iota
	CodecMsgp
)
View Source
const (
	KPrefix       = "co:mqtt:"
	KSuffix       = "all"
	KSubscription = KPrefix + persistence.KSubscription
	KServerInfo   = KPrefix + persistence.KServerInfo
	KRetained     = KPrefix + persistence.KRetained
	KInflight     = KPrefix + persistence.KInflight
	KClient       = KPrefix + persistence.KClient
)

Variables

View Source
var (
	LocalIP         = "127.0.0.1"
	ErrNotConnected = errors.New("redis not connected")
	ErrEmptyStruct  = errors.New("struct cannot be empty")
)

Functions

This section is empty.

Types

type Store

type Store struct {
	persistence.Store
	// contains filtered or unexported fields
}

func New

func New(opts *redis.Options) *Store

func (*Store) Close

func (s *Store) Close()

Close closes the redis instance.

func (*Store) Del

func (s *Store) Del(key string) error

func (*Store) DeleteClient

func (s *Store) DeleteClient(cid string) error

DeleteClient deletes a client from the redis instance.

func (*Store) DeleteInflight

func (s *Store) DeleteInflight(cid string, pid uint16) error

DeleteInflight deletes an inflight message from the redis instance by the client id.

func (*Store) DeleteInflightBatch

func (s *Store) DeleteInflightBatch(cid string, pids []uint16) error

DeleteInflightBatch

func (*Store) DeleteRetained

func (s *Store) DeleteRetained(topic string) error

DeleteRetained deletes a retained message from the redis instance by the topic.

func (*Store) DeleteSubscription

func (s *Store) DeleteSubscription(cid, filter string) error

DeleteSubscription deletes a subscription from the redis instance.

func (*Store) GenInflightId

func (s *Store) GenInflightId(cid string, pid uint16) string

func (*Store) GenRetainedId

func (s *Store) GenRetainedId(topic string) string

func (*Store) GenSubscriptionId

func (s *Store) GenSubscriptionId(cid, filter string) string

func (*Store) HDel

func (s *Store) HDel(key string, ids ...string) error

func (*Store) HSet

func (s *Store) HSet(key string, id string, v interface{}) error

func (*Store) HSet2

func (s *Store) HSet2(key string, id string, val []byte) error

func (*Store) Open

func (s *Store) Open() error

func (*Store) ReadClientByCid

func (s *Store) ReadClientByCid(cid string) (v persistence.Client, err error)

ReadClientByCid read a client from the redis instance by the client id.

func (*Store) ReadInflightByCid

func (s *Store) ReadInflightByCid(cid string) (v []persistence.Message, err error)

ReadInflightByCid loads all the inflight messages from the redis instance by the client id.

func (*Store) ReadRetainedByTopic

func (s *Store) ReadRetainedByTopic(topic string) (v persistence.Message, err error)

ReadRetainedByTopic loads the retained message from the redis instance by the topic.

func (*Store) ReadServerInfo

func (s *Store) ReadServerInfo() (v persistence.ServerInfo, err error)

ReadServerInfo loads the server info from the redis instance.

func (*Store) ReadSubscriptionsByCid

func (s *Store) ReadSubscriptionsByCid(cid string) (v []persistence.Subscription, err error)

ReadSubscriptionsByCid loads all the subscriptions from the redis instance by the client id.

func (*Store) Set

func (s *Store) Set(key string, v interface{}) error

func (*Store) WriteClient

func (s *Store) WriteClient(v persistence.Client) error

WriteClient writes a single client to the redis instance.

func (*Store) WriteInflight

func (s *Store) WriteInflight(v persistence.Message) error

WriteInflight writes a single inflight message to the redis instance.

func (*Store) WriteRetained

func (s *Store) WriteRetained(v persistence.Message) error

WriteRetained writes a single retained message to the redis instance.

func (*Store) WriteServerInfo

func (s *Store) WriteServerInfo(v persistence.ServerInfo) error

WriteServerInfo writes the server info to the redis instance.

func (*Store) WriteSubscription

func (s *Store) WriteSubscription(v persistence.Subscription) error

WriteSubscription writes a single subscription to the redis instance.

Jump to

Keyboard shortcuts

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