store

package
v0.0.0-...-a01428d Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2017 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterProvider

func RegisterProvider(f func() StoreMgr)

Types

type Error

type Error int
const (
	//消息重复
	ErrDupMsg  Error = 1
	ErrNoExsit Error = 2
)

func (Error) Error

func (this Error) Error() string

type InflightStore

type InflightStore interface {
	//以ClientId&MsgId作key
	SaveByClientIdMsgId(msg *Msg) error
	//以Topic作为key
	SaveRetainMsg(topic string, body []byte, qos byte) error

	GetMsgByClientIdMsgId(clientId string, msgId uint16) (msg *Msg, err error)
	//根据消息Id删除消息
	RemoveMsgById(id int) error
}

发送中的消息存储

type Msg

type Msg struct {
	//Store里唯一的消息标识
	Id       int
	ClientId string
	//消息作者定义的id
	MsgId uint16
	Topic string
	Qos   byte
	Body  []byte
}

type ProviderFactory

type ProviderFactory func() StoreMgr

type RetainStore

type RetainStore interface {
	//Retain消息
	//获取所有离线消息
	GetAllRetainMsgs() (msgs []*Msg, err error)

	//删除topic的离线消息
	RemoveMsgByTopic(topic string) error
}

相关题的最后一条离线消息存储

type StoreMgr

type StoreMgr interface {
	InflightStore
	RetainStore
}

func NewStoreMgr

func NewStoreMgr() StoreMgr

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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