- Part Ⅰ 开发起步
- Part Ⅱ 注册中心
- Part Ⅲ 特性
- Part Ⅳ 插件
- Part Ⅴ 其它
- Part Ⅵ 网关
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
4.5 插件开发
rpcx为服务器和客户端定义了几个插件接口,在一些处理点上可以调用插件。
Server Plugin
示例: trace
type PostConnAcceptPlugin
type PostConnAcceptPlugin interface {
HandleConnAccept(net.Conn) (net.Conn, bool)
}
type PostReadRequestPlugin
type PostReadRequestPlugin interface {
PostReadRequest(ctx context.Context, r *protocol.Message, e error) error
}
PostReadRequestPlugin represents .
type PostWriteResponsePlugin
type PostWriteResponsePlugin interface {
PostWriteResponse(context.Context, *protocol.Message, *protocol.Message, error) error
}
PostWriteResponsePlugin represents .
type PreReadRequestPlugin
type PreReadRequestPlugin interface {
PreReadRequest(ctx context.Context) error
}
PreReadRequestPlugin represents .
type PreWriteResponsePlugin
type PreWriteResponsePlugin interface {
PreWriteResponse(context.Context, *protocol.Message) error
}
PreWriteResponsePlugin represents .
Client Plugin
type PluginContainer
type PluginContainer interface {
Add(plugin Plugin)
Remove(plugin Plugin)
All() []Plugin
DoPreCall(ctx context.Context, servicePath, serviceMethod string, args interface{}) error
DoPostCall(ctx context.Context, servicePath, serviceMethod string, args interface{}, reply interface{}, err error) error
}
type PostCallPlugin
type PostCallPlugin interface {
DoPostCall(ctx context.Context, servicePath, serviceMethod string, args interface{}, reply interface{}, err error) error
}
PostCallPlugin is invoked after the client calls a server.
type PreCallPlugin
type PreCallPlugin interface {
DoPreCall(ctx context.Context, servicePath, serviceMethod string, args interface{}) error
}
PreCallPlugin is invoked before the client calls a server.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论