Documentation ¶
Index ¶
- func CallMethod(pImpl Proxy, call *ProxyCall, methodId uint32, msg proto.Message) (resp *protocol.ResponsePackage, err error)
- type CallMap
- type Proxy
- type ProxyBase
- func (base *ProxyBase) GetID() ProxyId
- func (base *ProxyBase) GetTargetID() uint32
- func (base *ProxyBase) GetTransport() transport.Transport
- func (base *ProxyBase) IsConnected() bool
- func (base *ProxyBase) SetID(id ProxyId)
- func (base *ProxyBase) SetTargetID(id uint32)
- func (base *ProxyBase) SetTransport(trans transport.Transport)
- type ProxyCall
- func (pc *ProxyCall) DecRetryTime()
- func (pc *ProxyCall) DoRet(resp *protocol.ResponsePackage)
- func (pc *ProxyCall) GetID() uint32
- func (pc *ProxyCall) GetProxyId() ProxyId
- func (pc *ProxyCall) GetRetryTime() int32
- func (pc *ProxyCall) GetTimeOut() uint32
- func (pc *ProxyCall) SetErrorCode(errCode uint32)
- type ProxyCallManager
- func (pcm *ProxyCallManager) Add(pc *ProxyCall) error
- func (pcm *ProxyCallManager) CreateProxyCall(proxyId ProxyId, timeOut uint32, retryTime int32) *ProxyCall
- func (pcm *ProxyCallManager) Destroy(callId uint32)
- func (pcm *ProxyCallManager) GenCallID() uint32
- func (pcm *ProxyCallManager) Get(callId uint32) *ProxyCall
- type ProxyCreator
- type ProxyCreatorMap
- type ProxyId
- type ProxyManager
- func (p *ProxyManager) Add(proxy Proxy) error
- func (p *ProxyManager) AddCreator(srvUid uint64, creator ProxyCreator)
- func (p *ProxyManager) Destroy(proxyId uint32) error
- func (p *ProxyManager) GeneProxyId() ProxyId
- func (p *ProxyManager) Get(proxyId ProxyId) (Proxy, error)
- func (p *ProxyManager) GetOrCreateByTrans(srvUid uint64, trans transport.Transport) (pInst Proxy, err error)
- type ProxyMap
- type Trans2Proxy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallMethod ¶
func CallMethod(pImpl Proxy, call *ProxyCall, methodId uint32, msg proto.Message) (resp *protocol.ResponsePackage, err error)
CallMethod proxy call helper rpc proxy call remote stub, create proxy call and wait for response
Types ¶
type Proxy ¶
type Proxy interface { // GetUUID service uuid // @detail get service uuid id which generated by rpc-repo GetUUID() uint64 // GetSignature // get method human-readable name GetSignature(uint32) string // GetID //get proxy instance ID, priority delivery service instance GetID() ProxyId // SetID // set proxy instance ID SetID(ProxyId) // SetTargetID // last return service id, maybe some service box need SetTargetID(uint32) // GetTargetID // return last return service id GetTargetID() uint32 // IsOneWay oneway //@detail is one way function which not wait for return //@param method id IsOneWay(uint32) bool // GetSrvName //@detail get proxy name GetSrvName() string // SetTransport // @detail set transport SetTransport(transport transport.Transport) // GetTransport //@detail get transport GetTransport() transport.Transport // IsConnected // check transport valid state IsConnected() bool }
Proxy Proxy, user's idl proxy interface, using as client to call remote function; rpc framewrok set transport to it
type ProxyBase ¶
type ProxyBase struct {
// contains filtered or unexported fields
}
ProxyBase proxy common struct impl
func (*ProxyBase) GetTargetID ¶
func (*ProxyBase) GetTransport ¶
func (*ProxyBase) IsConnected ¶
func (*ProxyBase) SetTargetID ¶
func (*ProxyBase) SetTransport ¶
SetTransport set network message transport @detail been called by proxy creater
type ProxyCall ¶
type ProxyCall struct {
// contains filtered or unexported fields
}
ProxyCall rpc-proxy call information of remote call description
func (*ProxyCall) DecRetryTime ¶
func (pc *ProxyCall) DecRetryTime()
DecRetryTime decrease retry time, read & write in worker goroutine
func (*ProxyCall) DoRet ¶
func (pc *ProxyCall) DoRet(resp *protocol.ResponsePackage)
func (*ProxyCall) GetProxyId ¶
func (*ProxyCall) GetRetryTime ¶
GetRetryTime get left retry time
func (*ProxyCall) GetTimeOut ¶
GetTimeOut timeout millisecond
func (*ProxyCall) SetErrorCode ¶
type ProxyCallManager ¶
type ProxyCallManager struct {
// contains filtered or unexported fields
}
ProxyCallManager manager proxy call for multi goroutine
func NewCallManager ¶
func NewCallManager() *ProxyCallManager
func (*ProxyCallManager) Add ¶
func (pcm *ProxyCallManager) Add(pc *ProxyCall) error
func (*ProxyCallManager) CreateProxyCall ¶
func (pcm *ProxyCallManager) CreateProxyCall(proxyId ProxyId, timeOut uint32, retryTime int32) *ProxyCall
func (*ProxyCallManager) Destroy ¶
func (pcm *ProxyCallManager) Destroy(callId uint32)
func (*ProxyCallManager) GenCallID ¶
func (pcm *ProxyCallManager) GenCallID() uint32
func (*ProxyCallManager) Get ¶
func (pcm *ProxyCallManager) Get(callId uint32) *ProxyCall
type ProxyCreator ¶
ProxyCreator proxy creator, one client may connect to differently service
type ProxyCreatorMap ¶
type ProxyCreatorMap map[uint64]ProxyCreator
type ProxyManager ¶
type ProxyManager struct {
// contains filtered or unexported fields
}
ProxyManager manager connect proxy for rpc framework, multiple may be read & write TODO add tranport id 2 service uid cache
func NewProxyManager ¶
func NewProxyManager() *ProxyManager
NewProxyManager create new proxy manager, init proxymap and mutex
func (*ProxyManager) Add ¶
func (p *ProxyManager) Add(proxy Proxy) error
func (*ProxyManager) AddCreator ¶
func (p *ProxyManager) AddCreator(srvUid uint64, creator ProxyCreator)
AddCreator add proxy creator while init package, goroutine not start yet
func (*ProxyManager) Destroy ¶
func (p *ProxyManager) Destroy(proxyId uint32) error
func (*ProxyManager) GeneProxyId ¶
func (p *ProxyManager) GeneProxyId() ProxyId