sessions

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSessionsProviderNotFound = errors.New("Session: Session provider not found")
	ErrKeyNotAvailable          = errors.New("Session: not item found for key.")
)

Functions

func NewMemProvider

func NewMemProvider() *memProvider

func Register

func Register(name string, provider SessionsProvider)

Register makes a session provider available by the provided name. If a Register is called twice with the same name or if the driver is nil, it panics.

func Unregister

func Unregister(name string)

Types

type Manager

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

func NewManager

func NewManager(providerName string) (*Manager, error)

func (*Manager) Close

func (this *Manager) Close() error

func (*Manager) Count

func (this *Manager) Count() int

func (*Manager) Del

func (this *Manager) Del(id string)

func (*Manager) Get

func (this *Manager) Get(id string) (*Session, error)

func (*Manager) New

func (this *Manager) New(id string) (*Session, error)

func (*Manager) Save

func (this *Manager) Save(id string) error

type Session

type Session struct {

	// Will message to publish if connect is closed unexpectedly
	Will *packets.PublishPacket

	// Retained publish message
	Retained *packets.PublishPacket
	// contains filtered or unexported fields
}

func (*Session) AddTopic

func (this *Session) AddTopic(topic string, qos byte) error

func (*Session) CleanSession

func (this *Session) CleanSession() bool

func (*Session) ID

func (this *Session) ID() string

func (*Session) Init

func (this *Session) Init(msg *packets.ConnectPacket) error

func (*Session) RemoveTopic

func (this *Session) RemoveTopic(topic string) error

func (*Session) RetainMessage

func (this *Session) RetainMessage(msg *packets.PublishPacket) error

func (*Session) SetWillFlag

func (this *Session) SetWillFlag(v bool)

func (*Session) Topics

func (this *Session) Topics() ([]string, []byte, error)

func (*Session) Update

func (this *Session) Update(msg *packets.ConnectPacket) error

func (*Session) WillFlag

func (this *Session) WillFlag() bool

type SessionsProvider

type SessionsProvider interface {
	New(id string) (*Session, error)
	Get(id string) (*Session, error)
	Del(id string)
	Save(id string) error
	Count() int
	Close() error
}

Jump to

Keyboard shortcuts

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