Documentation
¶
Overview ¶
Package gap Golaxy应用层协议(golaxy application protocol),适用于开发应用层通信消息,需要工作在GTP协议或MQ之上,支持消息判重,解决了幂等性问题。
- 可以实现消息(Msg)接口新增自定义消息。
- 支持可变类型(Variant),提供了一些常用的内置类型,也可以实现可变类型值(variant.Value)接口,新增自定义类型。
- 支持自己实现消息(Msg)接口或可变类型值(variant.Value)接口,扩展支持protobuf(Protocol Buffers)等消息结构。
- 支持消息判重,解决幂等性问题。
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotDeclared = errors.New("gap: msg not declared") // 消息未注册
)
Functions ¶
func Marshal ¶ added in v0.1.36
func Marshal[T Msg](msg T) (binaryutil.RecycleBytes, error)
Types ¶
type IMsgCreator ¶
type IMsgCreator interface {
// Declare 注册消息
Declare(msg Msg)
// Undeclare 取消注册消息
Undeclare(msgId MsgId)
// New 创建消息指针
New(msgId MsgId) (Msg, error)
}
IMsgCreator 消息对象构建器接口
type MsgForward ¶ added in v0.1.32
type MsgForward struct {
Transit string // 中转地址
Dst string // 目标地址
CorrId int64 // 关联Id,用于支持Future等异步模型
TransId MsgId // 传输消息Id
TransData []byte // 传输消息内容(引用)
}
MsgForward 转发
type MsgOneWayRPC ¶
MsgOneWayRPC 单程RPC请求
type MsgRPCReply ¶
type MsgRPCReply struct {
CorrId int64 // 关联Id,用于支持Future等异步模型
Rets variant.Array // 调用结果
Error variant.Error // 调用错误
}
MsgRPCReply RPC答复
type MsgRPCRequest ¶
type MsgRPCRequest struct {
CorrId int64 // 关联Id,用于支持Future等异步模型
Path string // 调用路径
Args variant.Array // 参数列表
}
MsgRPCRequest RPC请求
type MsgRaw ¶ added in v0.1.32
MsgRaw 原始消息
Source Files
¶
Click to show internal directories.
Click to hide internal directories.