本文整理匯總了Golang中rpc.Request.ServiceMethod方法的典型用法代碼示例。如果您正苦於以下問題:Golang Request.ServiceMethod方法的具體用法?Golang Request.ServiceMethod怎麽用?Golang Request.ServiceMethod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rpc.Request
的用法示例。
在下文中一共展示了Request.ServiceMethod方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ReadRequestHeader
func (c *serverCodec) ReadRequestHeader(r *rpc.Request) (err os.Error) {
c.req.header.Reset()
lbuf := make([]byte, lenSize)
_, err = io.ReadFull(c.c, lbuf)
if err != nil {
return
}
pbuf := make([]byte, decodeLen(lbuf))
_, err = io.ReadFull(c.c, pbuf)
if err != nil {
return
}
c.req.header.SetBuf(pbuf)
h := new(Header)
err = c.req.header.Unmarshal(h)
if err != nil {
return
}
r.Seq = *h.Seq
r.ServiceMethod = *h.ServiceMethod
return
}
示例2: ReadRequestHeader
func (qx *queryCodec) ReadRequestHeader(req *rpc.Request) os.Error {
if qx.seq == 0 {
return os.EOF
}
req.Seq = qx.seq
req.ServiceMethod = pathToServiceMethod(qx.Req.URL.Path)
return nil
}
示例3: ReadRequestHeader
func (c *serverCodec) ReadRequestHeader(r *rpc.Request) os.Error {
c.req.reset()
if err := c.dec.Decode(&c.req); err != nil {
return err
}
r.ServiceMethod = c.req.Method
// JSON request id can be any JSON value;
// RPC package expects uint64. Translate to
// internal uint64 and save JSON on the side.
c.mutex.Lock()
c.seq++
c.pending[c.seq] = c.req.Id
c.req.Id = nil
r.Seq = c.seq
c.mutex.Unlock()
return nil
}