Documentation
¶
Index ¶
- func DynamicCall(ctx Ctx, serviceMethod string, arg interface{}, result interface{}, ...) tp.CallCmd
- func DynamicPush(ctx Ctx, serviceMethod string, arg interface{}, setting ...tp.MessageSetting) *tp.Status
- func GetDynamicClient() *micro.Client
- func GetEtcdCfg() etcd.EasyConfig
- func GetEtcdClient() *etcd.Client
- func GetProtoFunc() tp.ProtoFunc
- func SetProtoFunc(_protoFunc tp.ProtoFunc)
- func StaticCall(ctx Ctx, addr string, serviceMethod string, arg interface{}, ...) tp.CallCmd
- func StaticPush(ctx Ctx, addr string, serviceMethod string, arg interface{}, ...) *tp.Status
- type Ctx
- type StaticClients
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DynamicCall ¶
func DynamicCall(ctx Ctx, serviceMethod string, arg interface{}, result interface{}, setting ...tp.MessageSetting) tp.CallCmd
DynamicCall sends a packet and receives reply, by etcd discovery. Note: The ctx can be nil; If the arg is []byte or *[]byte type, it can automatically fill in the body codec name; If the session is a client role and PeerConfig.RedialTimes>0, it is automatically re-called once after a failure.
func DynamicPush ¶
func DynamicPush(ctx Ctx, serviceMethod string, arg interface{}, setting ...tp.MessageSetting) *tp.Status
DynamicPush sends a packet by etcd discovery, but do not receives reply. Note: The ctx can be nil; If the arg is []byte or *[]byte type, it can automatically fill in the body codec name; If the session is a client role and PeerConfig.RedialTimes>0, it is automatically re-called once after a failure.
func GetDynamicClient ¶
func GetDynamicClient() *micro.Client
GetDynamicClient returns the common client with etcd discovery.
func GetEtcdClient ¶
GetEtcdClient returns the common ETCD client.
func GetProtoFunc ¶
GetProtoFunc sets the socket communication protocol.
func SetProtoFunc ¶
SetProtoFunc sets the socket communication protocol.
func StaticCall ¶
func StaticCall(ctx Ctx, addr string, serviceMethod string, arg interface{}, result interface{}, setting ...tp.MessageSetting) tp.CallCmd
StaticCall sends a packet and receives reply, by address. Note: The ctx can be nil; If the arg is []byte or *[]byte type, it can automatically fill in the body codec name; If the session is a client role and PeerConfig.RedialTimes>0, it is automatically re-called once after a failure.
func StaticPush ¶
func StaticPush(ctx Ctx, addr string, serviceMethod string, arg interface{}, setting ...tp.MessageSetting) *tp.Status
StaticPush sends a packet by address, but do not receives reply. Note: The ctx can be nil; If the arg is []byte or *[]byte type, it can automatically fill in the body codec name; If the session is a client role and PeerConfig.RedialTimes>0, it is automatically re-called once after a failure.
Types ¶
type Ctx ¶
type Ctx interface {
// Seq returns the input packet sequence.
Seq() int32
// RealIp returns the the current real remote addr.
RealIp() string
// Query returns the input packet uri query object.
Query() url.Values
}
Ctx handler's context
type StaticClients ¶
type StaticClients struct {
// contains filtered or unexported fields
}
StaticClients static clients map
func GetStaticClients ¶
func GetStaticClients() *StaticClients
GetStaticClients returns the common static client set.
func (*StaticClients) Get ¶
func (s *StaticClients) Get(srvAddr string) (*micro.Client, bool)
Get returns the client whose server address is srvAddr.
func (*StaticClients) GetOrSet ¶
func (s *StaticClients) GetOrSet(srvAddr string) *micro.Client
GetOrSet returns the client whose server address is srvAddr. If the client does not exist, set and return it.
func (*StaticClients) Set ¶
func (s *StaticClients) Set(srvAddr string)
Set sets the client whose server address is srvAddr.