Versions in this module Expand all Collapse all v0 v0.0.1 Nov 18, 2015 Changes in this version + const LANE_READBUF_LEN + const LANE_WRITEBUF_LEN + const READ_BUF_SIZE + var EIDLE_AGENT = errors.New("It is a Idle Agent!") + var EINDEX = errors.New("A Invalied Agent Index!") + var ENETWORK = errors.New("Unknown Network Type!") + var ENOAGENT = errors.New("Don't Have Such a Agent") + var ENewAgent = errors.New("New a Agent Error!") + var ENewConn = errors.New("New Connection Error!") + var EREMOVE_TYPE = errors.New("Remove from List Error!") + var EURL = errors.New("Invaliad URL!") + var ErrAddr = errors.New("Address may be invalied") + var ErrArg = errors.New("Argument's error") + var Logger *log.Logger + func DealNewAgent(conn *Connection, req *Request) (err error) + func Exit() + func Start() + func Version() string + type Addr struct + IPPort string + Kpal bool + Network string + func ParseAddr(url string) (addr Addr, err error) + type Agent struct + func (ag *Agent) DealConnReq(req *Request) (err error) + func (ag *Agent) DealNewAgentRsp() (err error) + func (ag *Agent) DealNodeMsg(data []byte) (err error) + func (ag *Agent) DealRequest(req *Request) (err error) + func (ag *Agent) ID() uint32 + func (ag *Agent) Send2Node(data []byte) (err error) + type AgentMgr struct + func NewAgentMgr(maxAgents int) (agentMgr *AgentMgr, err error) + func (am *AgentMgr) Alloc() (agent *Agent, err error) + func (am *AgentMgr) FindAgent(id uint32) (agent *Agent, err error) + func (am *AgentMgr) Init(maxAgents int) error + type BackendServer struct + Addr string + Bridge *Bridge + func (bs *BackendServer) AcceptAndServe(ln *net.UnixListener) + func (bs *BackendServer) Dispatch() (lane *Lane, err error) + func (bs *BackendServer) Init() (err error) + func (bs *BackendServer) Listen() (err error) + type Bridge struct + func (b *Bridge) Alloc(rwc *net.UnixConn) (lane *Lane, err error) + func (b *Bridge) Dispatch() (lane *Lane, err error) + type ConfigInfo struct + InnerAddr string + MaxConns int + OuterAddr string + var Config ConfigInfo + type ConnPool struct + func NewMLConnPool(size int) (conn *ConnPool, err error) + func (cp *ConnPool) Alloc() (conn *Connection, err error) + func (cp *ConnPool) Init() error + func (cp *ConnPool) Release(conn *Connection) (err error) + type Connection struct + AgentID uint32 + Elem *list.Element + ID int + RWC *net.TCPConn + ReadBuf []byte + Server *Server + func (conn *Connection) Close() error + func (conn *Connection) DealNewAgent(req *Request) + func (conn *Connection) DealSendReq(req *Request) + func (conn *Connection) Init() error + func (conn *Connection) RecvRequest() (req *Request, err error) + func (conn *Connection) SendResponse(rsp *Response) (err error) + func (conn *Connection) Serve() + type Lane struct + RWC *net.UnixConn + ReadBuf []byte + func (l *Lane) AddAgent(agent *Agent) (err error) + func (l *Lane) DealConnReq(msg *proto.KnotMessage) (err error) + func (l *Lane) DealMsgK2N(msg *proto.KnotMessage) (err error) + func (l *Lane) DealNewAgentRsp(msg *proto.KnotMessage) (err error) + func (l *Lane) Init() (err error) + func (l *Lane) ReadMsg() (msg *proto.KnotMessage, err error) + func (l *Lane) SendNewAgent(id uint32) (err error) + func (l *Lane) SendNodeMsg(id uint32, data []byte) (err error) + func (l *Lane) Serve() + func (l *Lane) TickSeq() uint32 + type Request struct + AgentID uint32 + Body []byte + CMD uint16 + type Response struct + AgentID uint32 + Body []byte + CMD uint16 + func (rsp *Response) Init() + type Server struct + Addr string + AgentMgr *AgentMgr + Backend *BackendServer + ConnPool *ConnPool + func (svr *Server) Init(maxConns int) (err error) + func (svr *Server) ListenAndServe() error + func (svr *Server) ListenAndServeTCP(l *net.TCPListener, kpal bool) error