Documentation ¶
Index ¶
- Constants
- func GenerateMsgID() uint64
- func NewHighwayClient(options client.Options) client.ProtocolClient
- type BaseClient
- func (baseClient *BaseClient) AddWaitMsg(msgID uint64, result *InvocationContext)
- func (baseClient *BaseClient) Close()
- func (baseClient *BaseClient) Closed() bool
- func (baseClient *BaseClient) GetAddr() string
- func (baseClient *BaseClient) GetWaitMsg(msgID uint64) *InvocationContext
- func (baseClient *BaseClient) Open() error
- func (baseClient *BaseClient) RemoveWaitMsg(msgID uint64)
- func (baseClient *BaseClient) Send(req *Request, rsp *Response, timeout time.Duration) error
- type ClientConnection
- func (hwClientConn *ClientConnection) AsyncSendMsg(ctx *InvocationContext) error
- func (hwClientConn *ClientConnection) Close()
- func (hwClientConn *ClientConnection) Closed() bool
- func (hwClientConn *ClientConnection) Hello() error
- func (hwClientConn *ClientConnection) Open() error
- func (hwClientConn *ClientConnection) PostMsg(req *Request) error
- type ClientMgr
- type ConnParams
- type InvocationContext
- type ProtocolObject
- func (msgObj *ProtocolObject) DeSerializeFrame(rdBuf *bufio.Reader) error
- func (msgObj *ProtocolObject) DeSerializeReq(req *Request) error
- func (msgObj *ProtocolObject) DeSerializeRsp(rsp *Response) error
- func (msgObj *ProtocolObject) ProtocolName() string
- func (msgObj *ProtocolObject) SerializeHelloReq(wBuf *bufio.Writer) error
- func (msgObj *ProtocolObject) SerializeLoginRap(msgID uint64, wBuf *bufio.Writer) error
- func (msgObj *ProtocolObject) SerializeReq(req *Request, wBuf *bufio.Writer)
- func (msgObj *ProtocolObject) SerializeRsp(rsp *Response, wBuf *bufio.Writer)
- type Request
- type Response
Constants ¶
const ( DefaultReadBufferSize = 0 DefaultWriteBufferSize = 1024 )
constant for buffer size
const ( //Name is a variable of type string Name = "highway" DefaultConnectTimeOut = 60 DefaultSendTimeOut = 300 )
const timeout
const ( FrameHeadLen = 23 MagicLen = 7 )
number const
const ( Ok = 200 ServerError = 505 )
status code
Variables ¶
This section is empty.
Functions ¶
func NewHighwayClient ¶
func NewHighwayClient(options client.Options) client.ProtocolClient
NewHighwayClient is a function
Types ¶
type BaseClient ¶ added in v0.7.1
type BaseClient struct {
// contains filtered or unexported fields
}
BaseClient highway base client
func (*BaseClient) AddWaitMsg ¶ added in v0.7.1
func (baseClient *BaseClient) AddWaitMsg(msgID uint64, result *InvocationContext)
AddWaitMsg add wait msg
func (*BaseClient) Closed ¶ added in v0.7.1
func (baseClient *BaseClient) Closed() bool
Closed client status
func (*BaseClient) GetAddr ¶ added in v0.7.1
func (baseClient *BaseClient) GetAddr() string
GetAddr Obtain the address
func (*BaseClient) GetWaitMsg ¶ added in v0.7.1
func (baseClient *BaseClient) GetWaitMsg(msgID uint64) *InvocationContext
GetWaitMsg get wait message
func (*BaseClient) RemoveWaitMsg ¶ added in v0.7.1
func (baseClient *BaseClient) RemoveWaitMsg(msgID uint64)
RemoveWaitMsg remove wait msg
type ClientConnection ¶ added in v0.7.1
type ClientConnection struct {
// contains filtered or unexported fields
}
ClientConnection Highway client connection
func NewHighwayClientConnection ¶
func NewHighwayClientConnection(conn net.Conn, client *BaseClient) *ClientConnection
NewHighwayClientConnection creat Highway client connection
func (*ClientConnection) AsyncSendMsg ¶ added in v0.7.1
func (hwClientConn *ClientConnection) AsyncSendMsg(ctx *InvocationContext) error
AsyncSendMsg Highway send message
func (*ClientConnection) Close ¶ added in v0.7.1
func (hwClientConn *ClientConnection) Close()
Close the connection
func (*ClientConnection) Closed ¶ added in v0.7.1
func (hwClientConn *ClientConnection) Closed() bool
Closed Highway connection status
func (*ClientConnection) Hello ¶ added in v0.7.1
func (hwClientConn *ClientConnection) Hello() error
Hello Highway handshake
func (*ClientConnection) Open ¶ added in v0.7.1
func (hwClientConn *ClientConnection) Open() error
Open Init Highway client connection
func (*ClientConnection) PostMsg ¶ added in v0.7.1
func (hwClientConn *ClientConnection) PostMsg(req *Request) error
PostMsg Highway post message, Respond is needless
type ClientMgr ¶
type ClientMgr struct {
// contains filtered or unexported fields
}
ClientMgr client manage
var CachedClients *ClientMgr
CachedClients client cache
func (*ClientMgr) GetClient ¶
func (mgr *ClientMgr) GetClient(connParmas *ConnParams) (*BaseClient, error)
GetClient Obtain client
type ConnParams ¶
ConnParams highway connect parmas
type InvocationContext ¶
type InvocationContext struct { Req *Request Rsp *Response Wait *chan int // contains filtered or unexported fields }
InvocationContext Highway context
type ProtocolObject ¶ added in v0.7.1
type ProtocolObject struct { FrHead highwayFrameHead // contains filtered or unexported fields }
ProtocolObject highway Protocal
func (*ProtocolObject) DeSerializeFrame ¶ added in v0.7.1
func (msgObj *ProtocolObject) DeSerializeFrame(rdBuf *bufio.Reader) error
DeSerializeFrame Deserialize frame
func (*ProtocolObject) DeSerializeReq ¶ added in v0.7.1
func (msgObj *ProtocolObject) DeSerializeReq(req *Request) error
DeSerializeReq Deserialize req
func (*ProtocolObject) DeSerializeRsp ¶ added in v0.7.1
func (msgObj *ProtocolObject) DeSerializeRsp(rsp *Response) error
DeSerializeRsp Deserialize rsp
func (*ProtocolObject) ProtocolName ¶ added in v0.7.1
func (msgObj *ProtocolObject) ProtocolName() string
ProtocolName protocal name
func (*ProtocolObject) SerializeHelloReq ¶ added in v0.7.1
func (msgObj *ProtocolObject) SerializeHelloReq(wBuf *bufio.Writer) error
SerializeHelloReq Serialize hello req
func (*ProtocolObject) SerializeLoginRap ¶ added in v0.7.1
func (msgObj *ProtocolObject) SerializeLoginRap(msgID uint64, wBuf *bufio.Writer) error
SerializeLoginRap Serialize hello req
func (*ProtocolObject) SerializeReq ¶ added in v0.7.1
func (msgObj *ProtocolObject) SerializeReq(req *Request, wBuf *bufio.Writer)
SerializeReq Serialize request
func (*ProtocolObject) SerializeRsp ¶ added in v0.7.1
func (msgObj *ProtocolObject) SerializeRsp(rsp *Response, wBuf *bufio.Writer)
SerializeRsp Serialize frame