clientele

package
v6.0.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

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 GetEtcdCfg

func GetEtcdCfg() etcd.EasyConfig

GetEtcdCfg returns the etcd config.

func GetEtcdClient

func GetEtcdClient() *etcd.Client

GetEtcdClient returns the common ETCD client.

func GetProtoFunc

func GetProtoFunc() tp.ProtoFunc

GetProtoFunc sets the socket communication protocol.

func SetProtoFunc

func SetProtoFunc(_protoFunc tp.ProtoFunc)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL