Documentation
¶
Index ¶
- type Option
- func OptBodyCodec(c string) Option
- func OptContextAge(n time.Duration) Option
- func OptCustomService(service *registry.Service) Option
- func OptGlobalPlugin(plugin ...drpc.Plugin) Option
- func OptHeartbeatTime(t time.Duration) Option
- func OptLocalIP(addr string) Option
- func OptMetrics(m metrics.Metrics) Option
- func OptNetwork(net string) Option
- func OptPrintDetail(c bool) Option
- func OptProtoFunc(pf proto.ProtoFunc) Option
- func OptRegistry(r registry.Registry) Option
- func OptRetryTimes(n int) Option
- func OptSelector(s selector.Selector) Option
- func OptServiceName(name string) Option
- func OptServiceVersion(version string) Option
- func OptSessionAge(n time.Duration) Option
- func OptSlowCometDuration(n time.Duration) Option
- func OptTlsConfig(config *tls.Config) Option
- func OptTlsFile(tlsCertFile string, tlsKeyFile string) Option
- type Options
- type RpcClient
- func (that *RpcClient) AsyncCall(serviceMethod string, arg interface{}, result interface{}, ...) drpc.CallCmd
- func (that *RpcClient) Call(serviceMethod string, args interface{}, result interface{}, ...) drpc.CallCmd
- func (that *RpcClient) Close()
- func (that *RpcClient) Endpoint() drpc.Endpoint
- func (that *RpcClient) Options() Options
- func (that *RpcClient) Push(serviceMethod string, arg interface{}, setting ...message.MsgSetting) *drpc.Status
- func (that *RpcClient) RoutePush(ctrlStruct interface{}, plugin ...drpc.Plugin) []string
- func (that *RpcClient) RoutePushFunc(pushHandleFunc interface{}, plugin ...drpc.Plugin) string
- func (that *RpcClient) SubRoute(pathPrefix string, plugin ...drpc.Plugin) *drpc.SubRouter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Options)
func OptContextAge ¶ added in v1.0.1
OptContextAge 设置单次请求生命周期
func OptCustomService ¶ added in v1.0.1
OptCustomService 自定义service
func OptGlobalPlugin ¶ added in v1.0.1
OptGlobalPlugin 设置插件
func OptHeartbeatTime ¶ added in v1.0.1
OptHeartbeatTime 设置心跳包时间
func OptProtoFunc ¶ added in v1.0.1
OptProtoFunc 设置协议方法
func OptRegistry ¶ added in v1.0.1
OptRegistry 设置服务注册中心
func OptServiceVersion ¶ added in v1.0.1
OptServiceVersion 当前服务版本
func OptSessionAge ¶ added in v1.0.1
OptSessionAge 设置会话生命周期
func OptSlowCometDuration ¶ added in v1.0.1
OptSlowCometDuration 设置慢请求的定义时间
func OptTlsConfig ¶ added in v1.0.1
OptTlsConfig 设置证书对象
func OptTlsFile ¶ added in v1.0.1
OptTlsFile 设置证书内容
type Options ¶
type Options struct {
Context context.Context // 上下文
ServiceName string // 服务名称
ServiceVersion string // 服务版本
Network string // 网络类型
LocalIP string // 本地网络
TlsCertFile string
TlsKeyFile string
TLSConfig *tls.Config
ProtoFunc proto.ProtoFunc
SessionAge time.Duration
ContextAge time.Duration
DialTimeout time.Duration
SlowCometDuration time.Duration
BodyCodec string
PrintDetail bool
HeartbeatTime time.Duration
RetryTimes int
GlobalPlugin []drpc.Plugin
Registry registry.Registry
Selector selector.Selector
Metrics metrics.Metrics // 统计信息
}
func (*Options) EndpointConfig ¶
func (that *Options) EndpointConfig() drpc.EndpointConfig
type RpcClient ¶
type RpcClient struct {
// contains filtered or unexported fields
}
RpcClient rpc客户端结构体
func NewRpcClient ¶
NewRpcClient 创建rpc客户端
func (*RpcClient) AsyncCall ¶
func (that *RpcClient) AsyncCall(serviceMethod string, arg interface{}, result interface{}, callCmdChan chan<- drpc.CallCmd, setting ...message.MsgSetting) drpc.CallCmd
AsyncCall 异步请求
func (*RpcClient) Call ¶
func (that *RpcClient) Call(serviceMethod string, args interface{}, result interface{}, setting ...message.MsgSetting) drpc.CallCmd
Call 请求服务端
func (*RpcClient) Push ¶
func (that *RpcClient) Push(serviceMethod string, arg interface{}, setting ...message.MsgSetting) *drpc.Status
Push 发送push消息
func (*RpcClient) RoutePushFunc ¶
RoutePushFunc 使用函数注册PUSH处理程序,并且返回地址
Click to show internal directories.
Click to hide internal directories.