Documentation ¶
Index ¶
- Constants
- Variables
- func DealNewAgent(conn *Connection, req *Request) (err error)
- func Exit()
- func Start()
- func Version() string
- type Addr
- type Agent
- type AgentMgr
- type BackendServer
- type Bridge
- type ConfigInfo
- type ConnPool
- type Connection
- 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
- 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
- type Response
- type Server
Constants ¶
View Source
const ( LANE_READBUF_LEN = 1024 * 100 LANE_WRITEBUF_LEN = 1024 * 100 )
View Source
const (
READ_BUF_SIZE = 10 * 1024
)
Variables ¶
View Source
var ( ENewAgent = errors.New("New a Agent Error!") EREMOVE_TYPE = errors.New("Remove from List Error!") EINDEX = errors.New("A Invalied Agent Index!") EIDLE_AGENT = errors.New("It is a Idle Agent!") ENOAGENT = errors.New("Don't Have Such a Agent") )
View Source
var ( EURL = errors.New("Invaliad URL!") ENETWORK = errors.New("Unknown Network Type!") )
View Source
var (
ENewConn = errors.New("New Connection Error!")
)
View Source
var (
ErrAddr = errors.New("Address may be invalied")
)
View Source
var ( // ErrArg is argument's error such as nil ErrArg = errors.New("Argument's error") )
View Source
var Logger *log.Logger
Functions ¶
func DealNewAgent ¶
func DealNewAgent(conn *Connection, req *Request) (err error)
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent is a client object
func (*Agent) DealConnReq ¶
DealConnReq deal connnection reqeuest
func (*Agent) DealNewAgentRsp ¶
func (*Agent) DealNodeMsg ¶
func (*Agent) DealRequest ¶
DealRequest deal a client's request
type AgentMgr ¶
type AgentMgr struct {
// contains filtered or unexported fields
}
func NewAgentMgr ¶
type BackendServer ¶
func (*BackendServer) AcceptAndServe ¶
func (bs *BackendServer) AcceptAndServe(ln *net.UnixListener)
func (*BackendServer) Dispatch ¶
func (bs *BackendServer) Dispatch() (lane *Lane, err error)
func (*BackendServer) Init ¶
func (bs *BackendServer) Init() (err error)
func (*BackendServer) Listen ¶
func (bs *BackendServer) Listen() (err error)
type ConfigInfo ¶
var Config ConfigInfo
type ConnPool ¶
type ConnPool struct {
// contains filtered or unexported fields
}
func NewMLConnPool ¶
func (*ConnPool) Alloc ¶
func (cp *ConnPool) Alloc() (conn *Connection, err error)
func (*ConnPool) Release ¶
func (cp *ConnPool) Release(conn *Connection) (err error)
type Connection ¶
type Connection struct { RWC *net.TCPConn ReadBuf []byte ID int Elem *list.Element AgentID uint32 Server *Server }
func (*Connection) Close ¶
func (conn *Connection) Close() error
func (*Connection) DealNewAgent ¶
func (conn *Connection) DealNewAgent(req *Request)
func (*Connection) DealSendReq ¶
func (conn *Connection) DealSendReq(req *Request)
func (*Connection) Init ¶
func (conn *Connection) Init() error
func (*Connection) RecvRequest ¶
func (conn *Connection) RecvRequest() (req *Request, err error)
func (*Connection) SendResponse ¶
func (conn *Connection) SendResponse(rsp *Response) (err error)
func (*Connection) Serve ¶
func (conn *Connection) Serve()
type Lane ¶
func (*Lane) DealConnReq ¶
func (l *Lane) DealConnReq(msg *proto.KnotMessage) (err error)
func (*Lane) DealMsgK2N ¶
func (l *Lane) DealMsgK2N(msg *proto.KnotMessage) (err error)
func (*Lane) DealNewAgentRsp ¶
func (l *Lane) DealNewAgentRsp(msg *proto.KnotMessage) (err error)
func (*Lane) SendNewAgent ¶
type Server ¶
type Server struct { /** * Address to listen such as * "tcp://114.1.0.1?keep-alive=true" * "tcp://114.1.0.1:80?keep-alive=false" * "udp://114.1.0.1:8088" */ Addr string /** * Coonection pool for client */ ConnPool *ConnPool /** * Agent Manger */ AgentMgr *AgentMgr Backend *BackendServer }
func (*Server) ListenAndServe ¶
func (*Server) ListenAndServeTCP ¶
func (svr *Server) ListenAndServeTCP(l *net.TCPListener, kpal bool) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.