store

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseStore

type BaseStore interface {
	Start(ctx context.Context, config config.SIConfig) error
	Stop(ctx context.Context) error
}

type EventStore

type EventStore interface {
	BaseStore
	PubEvent(ctx context.Context, event common.Event) error
	GetEvent(ctx context.Context, maxEventTime int64) ([]common.Event, error)
	GetEventMaxTime(ctx context.Context) (int64, error)
}

type MessageStore

type MessageStore interface {
	BaseStore

	StoreWillMessage(ctx context.Context, clientId string, message *messagev5.PublishMessage) error
	ClearWillMessage(ctx context.Context, clientId string) error
	GetWillMessage(ctx context.Context, clientId string) (*messagev5.PublishMessage, error)

	StoreRetainMessage(ctx context.Context, topic string, message *messagev5.PublishMessage) error
	ClearRetainMessage(ctx context.Context, topic string) error
	GetRetainMessage(ctx context.Context, topic string) (*messagev5.PublishMessage, error)

	GetAllRetainMsg(ctx context.Context) ([]*messagev5.PublishMessage, error)
}

type SessionStore

type SessionStore interface {
	BaseStore

	GetSession(ctx context.Context, clientId string) (sessionsv5.Session, error)
	StoreSession(ctx context.Context, clientId string, session sessionsv5.Session) error
	ClearSession(ctx context.Context, clientId string, clearOfflineMsg bool) error
	StoreSubscription(ctx context.Context, clientId string, subscription *messagev5.SubscribeMessage) error
	DelSubscription(ctx context.Context, client, topic string) error
	ClearSubscriptions(ctx context.Context, clientId string) error
	GetSubscriptions(ctx context.Context, clientId string) ([]*messagev5.SubscribeMessage, error)
	/**
	 * 缓存qos2 publish报文消息-入栈消息
	 * @return true:缓存成功   false:缓存失败
	 */
	CacheInflowMsg(ctx context.Context, clientId string, message messagev5.Message) error
	ReleaseInflowMsg(ctx context.Context, clientId string, pkId uint16) (messagev5.Message, error)
	GetAllInflowMsg(ctx context.Context, clientId string) ([]messagev5.Message, error)

	/**
	 * 缓存出栈消息-分发给客户端的qos1,qos2消息
	 */
	CacheOutflowMsg(ctx context.Context, client string, message messagev5.Message) error
	GetAllOutflowMsg(ctx context.Context, clientId string) ([]messagev5.Message, error)
	ReleaseOutflowMsg(ctx context.Context, clientId string, pkId uint16) (messagev5.Message, error)

	/**
	 * 出栈qos2第二阶段,缓存msgId
	 */
	CacheOutflowSecMsgId(ctx context.Context, clientId string, pkId uint16) error
	GetAllOutflowSecMsg(ctx context.Context, clientId string) ([]uint16, error)
	ReleaseOutflowSecMsgId(ctx context.Context, clientId string, pkId uint16) error

	StoreOfflineMsg(ctx context.Context, clientId string, message messagev5.Message) error
	GetAllOfflineMsg(ctx context.Context, clientId string) ([]messagev5.Message, []string, error)
	ClearOfflineMsgs(ctx context.Context, clientId string) error
	ClearOfflineMsgById(ctx context.Context, clientId string, msgIds []string) error
}

type Store

type Store interface {
	SetStore(store SessionStore, messageStore MessageStore)
}

Directories

Path Synopsis
orm

Jump to

Keyboard shortcuts

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