definition

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MqRpcName = "MqRpc"

	AUTH             = MqRpcName + ".Auth"
	CREATE_MQ        = MqRpcName + ".CreateMq"
	DELETE_MQ        = MqRpcName + ".DeleteMq"
	PUSH             = MqRpcName + ".Push"
	READ             = MqRpcName + ".Read"
	POP              = MqRpcName + ".Pop"
	DELETE           = MqRpcName + ".Delete"
	DROP             = MqRpcName + ".Drop"
	ACTIVE           = MqRpcName + ".Active"
	PING             = MqRpcName + ".Ping"
	LEN              = MqRpcName + ".Len"
	SET_KEY_VALUE    = MqRpcName + ".SetKeyValue"
	GET_KEY_VALUE    = MqRpcName + ".GetKeyValue"
	DELETE_KEY_VALUE = MqRpcName + ".DeleteKeyValue"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateMqArgs

type CreateMqArgs struct {
	Mq string
}

type CreateMqReply

type CreateMqReply struct{}

type DeleteMqArgs

type DeleteMqArgs struct {
	Mq string
}

type DeleteMqReply

type DeleteMqReply struct{}

type Mq

type Mq interface {
	// 创建队列
	CreateMq(mq string) (err error)

	// 删除队列
	DeleteMq(mq string) (err error)

	// 向队列里添加消息
	Push(mq string, msg string) (id uint64, err error)

	// 读取指定条数消息,并设置超时时间
	// 在时间范围内,消息不能再次被读取
	// 如果超出时间范围没有将消息删除或归档,消息会在下次被读取
	Read(mq string, num int, timeout time.Duration) (msgs []Msg, err error)

	// 从队列中读取指定条数消息
	// 并在队列中删除消息
	Pop(mq string, num int) (msgs []Msg, err error)

	// 从队列中删除指定消息
	Delete(mq string, id uint64) (err error)

	// 清空队列
	Drop(mq string) (err error)

	// 将消息存档
	Active(mq string, id uint64) (err error)

	// 获取队列长度
	Len(mq string) (int, error)

	// 设置键值对
	SetKeyValue(mq string, key string, value string, expire time.Duration) (err error)

	GetKeyValue(mq string, key string) (value *Value, ok bool, err error)

	DeleteKeyValue(mq string, key string) (err error)
}

type MqActiveArgs

type MqActiveArgs struct {
	Mq string
	Id uint64
}

type MqActiveReply

type MqActiveReply struct{}

type MqDeleteArgs

type MqDeleteArgs struct {
	Mq string
	Id uint64
}

type MqDeleteKeyValueArgs added in v0.0.2

type MqDeleteKeyValueArgs struct {
	Mq  string
	Key string
}

type MqDeleteKeyValueReply added in v0.0.2

type MqDeleteKeyValueReply struct{}

type MqDeleteReply

type MqDeleteReply struct{}

type MqDropArgs

type MqDropArgs struct {
	Mq string
}

type MqDropReply

type MqDropReply struct{}

type MqGetKeyValueArgs added in v0.0.2

type MqGetKeyValueArgs struct {
	Mq  string
	Key string
}

type MqGetKeyValueReply added in v0.0.2

type MqGetKeyValueReply struct {
	Value *Value
	Ok    bool
}

type MqLenArgs added in v0.0.2

type MqLenArgs struct {
	Mq string
}

type MqLenReply added in v0.0.2

type MqLenReply struct {
	Len int
}

type MqPopArgs

type MqPopArgs struct {
	Mq  string
	Num int
}

type MqPopReply

type MqPopReply struct {
	Msgs []Msg
}

type MqPushArgs

type MqPushArgs struct {
	Mq  string
	Msg string
}

type MqPushReply

type MqPushReply struct {
	Id uint64
}

type MqRPC

type MqRPC interface {
	CreateMq(args CreateMqArgs, reply *CreateMqReply) (err error)

	DeleteMq(args DeleteMqArgs, reply *DeleteMqReply) (err error)

	Push(args MqPushArgs, reply *MqPushReply) (err error)

	Read(args MqReadArgs, reply *MqReadReply) (err error)

	Pop(args MqPopArgs, reply *MqPopReply) (err error)

	Delete(args MqDeleteArgs, reply *MqDeleteReply) (err error)

	Drop(args MqDropArgs, reply *MqDropReply) (err error)

	Active(args MqActiveArgs, reply *MqActiveReply) (err error)

	Len(args MqLenArgs, reply *MqLenReply) (err error)

	SetKeyValue(args MqSetKeyValueArgs, reply *MqSetKeyValueReply) (err error)
	GetKeyValue(args MqGetKeyValueArgs, reply *MqGetKeyValueReply) (err error)
	DeleteKeyValue(args MqDeleteKeyValueArgs, reply *MqDeleteKeyValueReply) (err error)

	Ping(PingArgs, *PingReply) (err error)
}

type MqReadArgs

type MqReadArgs struct {
	Mq      string
	Num     int
	Timeout time.Duration
}

type MqReadReply

type MqReadReply struct {
	Msgs []Msg
}

type MqSetKeyValueArgs added in v0.0.2

type MqSetKeyValueArgs struct {
	Mq     string
	Key    string
	Value  string
	Expire *time.Time
}

type MqSetKeyValueReply added in v0.0.2

type MqSetKeyValueReply struct{}

type Msg

type Msg struct {
	Id        uint64
	Text      string
	CreatedAt time.Time
}

type PingArgs

type PingArgs struct{}

type PingReply

type PingReply struct{}

type Value added in v0.0.2

type Value struct {
	Value     string
	UpdatedAt time.Time
	ExpireAt  time.Time
}

Jump to

Keyboard shortcuts

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