Documentation
¶
Index ¶
- Constants
- func BindSID(agent *Agent)
- func BindUID(sid cfacade.SID, uid cfacade.UID) error
- func BuildSession(agent *Agent, msg *pmessage.Message) cproto.Session
- func ClusterLocalDataRoute(agent *Agent, session *cproto.Session, route *pmessage.Route, ...)
- func Count() int
- func DefaultDataRoute(agent *Agent, route *pmessage.Route, msg *pmessage.Message)
- func ForeachAgent(fn func(a *Agent))
- func GetRandMember(agent *Agent, route *pmessage.Route) (cfacade.IMember, bool)
- func LocalDataRoute(agent *Agent, session *cproto.Session, route *pmessage.Route, ...)
- func LocalInvokeFunc(app cfacade.IApplication, fi *creflect.FuncInfo, m *cfacade.Message)
- func PublishClusterLocal(agent *Agent, nodeId string, clusterPacket *cproto.ClusterPacket)
- func RemoteInvokeFunc(app cfacade.IApplication, fi *creflect.FuncInfo, m *cfacade.Message)
- func Unbind(sid cfacade.SID)
- type ActorBase
- func (p *ActorBase) Kick(session *cproto.Session, reason interface{}, close bool)
- func (p *ActorBase) Push(session *cproto.Session, route string, v interface{})
- func (p *ActorBase) Response(session *cproto.Session, v interface{})
- func (p *ActorBase) ResponseCode(session *cproto.Session, statusCode int32)
- type Agent
- func (a *Agent) AddOnClose(fn OnCloseFunc)
- func (a *Agent) App() cfacade.IApplication
- func (a *Agent) Bind(uid cfacade.UID) error
- func (a *Agent) Close()
- func (a *Agent) Kick(reason interface{}, close bool)
- func (a *Agent) Push(route string, val interface{})
- func (a *Agent) RemoteAddr() string
- func (a *Agent) Response(session *cproto.Session, v interface{}, isError ...bool)
- func (a *Agent) ResponseCode(session *cproto.Session, statusCode int32, isError ...bool)
- func (a *Agent) ResponseMID(mid uint32, v interface{}, isError ...bool)
- func (a *Agent) Run()
- func (a *Agent) SID() cfacade.SID
- func (a *Agent) SendRaw(bytes []byte)
- func (a *Agent) Session() *cproto.Session
- func (a *Agent) SetLastAt()
- func (a *Agent) SetState(state int32) bool
- func (a *Agent) State() int32
- func (a *Agent) UID() cfacade.UID
- func (a *Agent) Unbind()
- type AgentActor
- func (p *AgentActor) AddConnector(connector cfacade.IConnector)
- func (p *AgentActor) Load(app cfacade.IApplication)
- func (p *AgentActor) OnInit()
- func (*AgentActor) SetDataCompression(compression bool)
- func (*AgentActor) SetDictionary(dict map[string]uint16)
- func (*AgentActor) SetHeartbeat(t time.Duration)
- func (*AgentActor) SetOnDataRoute(fn DataRouteFunc)
- func (p *AgentActor) SetOnNewAgent(fn OnNewAgentFunc)
- func (*AgentActor) SetOnPacket(typ ppacket.Type, fn PacketFunc)
- func (*AgentActor) SetSysData(key string, value interface{})
- func (*AgentActor) SetWriteBacklog(size int)
- type Command
- type DataRouteFunc
- type OnCloseFunc
- type OnNewAgentFunc
- type PacketFunc
Constants ¶
View Source
const ( ResponseFuncName = "response" PushFuncName = "push" KickFuncName = "kick" )
View Source
const ( AgentInit int32 = 0 AgentWaitAck int32 = 1 AgentWorking int32 = 2 AgentClosed int32 = 3 )
Variables ¶
This section is empty.
Functions ¶
func ClusterLocalDataRoute ¶
func DefaultDataRoute ¶
func ForeachAgent ¶
func ForeachAgent(fn func(a *Agent))
func GetRandMember ¶
func LocalDataRoute ¶
func LocalInvokeFunc ¶
func PublishClusterLocal ¶
func PublishClusterLocal(agent *Agent, nodeId string, clusterPacket *cproto.ClusterPacket)
func RemoteInvokeFunc ¶
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
func (*Agent) AddOnClose ¶
func (a *Agent) AddOnClose(fn OnCloseFunc)
func (*Agent) App ¶
func (a *Agent) App() cfacade.IApplication
func (*Agent) RemoteAddr ¶
func (*Agent) ResponseCode ¶
func (*Agent) ResponseMID ¶
type AgentActor ¶
func NewActor ¶
func NewActor(agentActorID string) *AgentActor
func (*AgentActor) AddConnector ¶
func (p *AgentActor) AddConnector(connector cfacade.IConnector)
func (*AgentActor) Load ¶
func (p *AgentActor) Load(app cfacade.IApplication)
func (*AgentActor) SetDataCompression ¶
func (*AgentActor) SetDataCompression(compression bool)
func (*AgentActor) SetDictionary ¶
func (*AgentActor) SetDictionary(dict map[string]uint16)
func (*AgentActor) SetHeartbeat ¶
func (*AgentActor) SetHeartbeat(t time.Duration)
func (*AgentActor) SetOnDataRoute ¶
func (*AgentActor) SetOnDataRoute(fn DataRouteFunc)
func (*AgentActor) SetOnNewAgent ¶
func (p *AgentActor) SetOnNewAgent(fn OnNewAgentFunc)
func (*AgentActor) SetOnPacket ¶
func (*AgentActor) SetOnPacket(typ ppacket.Type, fn PacketFunc)
func (*AgentActor) SetSysData ¶
func (*AgentActor) SetSysData(key string, value interface{})
func (*AgentActor) SetWriteBacklog ¶
func (*AgentActor) SetWriteBacklog(size int)
type DataRouteFunc ¶
type OnCloseFunc ¶
type OnCloseFunc func(*Agent)
type OnNewAgentFunc ¶
type OnNewAgentFunc func(newAgent *Agent)
type PacketFunc ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.