Documentation ¶
Overview ¶
Package so goso 各接口的定义
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextRouter ¶
type ContextRouter struct{}
ContextRouter 路由
func (*ContextRouter) String ¶
func (ctx *ContextRouter) String() string
type ContextSeqID ¶
type ContextSeqID struct{}
ContextSeqID 客户端包
func (*ContextSeqID) String ¶
func (ctx *ContextSeqID) String() string
type ContextTraceID ¶
type ContextTraceID struct{}
ContextTraceID 服务端包ID
func (*ContextTraceID) String ¶
func (ctx *ContextTraceID) String() string
type ContextVersion ¶
type ContextVersion struct{}
ContextVersion 版本
func (*ContextVersion) String ¶
func (ctx *ContextVersion) String() string
type GatePack ¶
type GatePack interface { Verify() error // 校验包的有效性 GetRouter() Router // 获取路由 GetLogicPack() interface{} // 获取业务对象 GetContext() context.Context // 获取上下文 }
GatePack 网关包对象
type Handler ¶
type Handler interface { IsAnyNet(netType NetType) bool // 是否某个网络的处理器 GetName() string // 名称 GetRouter() (routers []Router) // 路由器对象 允许多个路由器指向相同处理器 router 如果是结构体必须提供 String() 方法 GetReq() interface{} // 请求结构体 空结构体 指针 GetResp() interface{} // 响应结构体 空结构体 指针 Handle(ctx context.Context, req, resp interface{}) error }
Handler 处理器定义
type Net ¶
type Net interface { SetGatePack(gatePack GatePack) error // gnet 需要 Register(handler Handler) error Start() error Stop() error }
Net ��网络传输服务
type Proxy ¶
type Proxy interface { IsHandler(ctx context.Context, router Router) (bool, error) // 判断是否本进程内能处理 RegisterCaller(nodeID string, hander Handler) error // 注册 FetchOneCaller(ctx context.Context, router Router) (caller Caller, err error) // 按照默认策略获取一个caller FetchTheCaller(ctx context.Context, router Router, addr *Addr) (caller Caller, err error) // 获取一个指定caller FetchAllCaller(ctx context.Context, router Router) (callers []Caller, err error) // 获取所有caller }
Proxy ��获取handler或caller
Click to show internal directories.
Click to hide internal directories.