Documentation ¶
Index ¶
- Variables
- type CancelFunc
- type DefaultContext
- func (this *DefaultContext) Cancel(err error)
- func (this *DefaultContext) Finish()
- func (this *DefaultContext) Get(name string) interface{}
- func (this *DefaultContext) GetCallback() lokas.AsyncCallBack
- func (this *DefaultContext) GetIdType(key string) util.ID
- func (this *DefaultContext) GetProcessIdType(key string) util.ProcessId
- func (this *DefaultContext) GetResp() interface{}
- func (this *DefaultContext) GetString(key string) string
- func (this *DefaultContext) GetTransId() uint32
- func (this *DefaultContext) Set(name string, data interface{})
- func (this *DefaultContext) SetCallback(cb lokas.AsyncCallBack)
- func (this *DefaultContext) SetResp(data interface{})
- type DefaultSession
- func (this *DefaultSession) AsyncCall(actorId util.ID, transId uint32, req protocol.ISerializable, ...) error
- func (this *DefaultSession) Call(actorId util.ID, transId uint32, req protocol.ISerializable, ...) error
- func (this *DefaultSession) CloneEntity() *ecs.Entity
- func (this *DefaultSession) GetConn() lokas.IConn
- func (this *DefaultSession) GetId() util.ID
- func (this *DefaultSession) GetProcess() lokas.IProcess
- func (this *DefaultSession) HandleMessage(f func(msg *protocol.BinaryMessage))
- func (this *DefaultSession) OnClose(conn lokas.IConn)
- func (this *DefaultSession) OnCreate() error
- func (this *DefaultSession) OnDestroy() error
- func (this *DefaultSession) OnMessage(actorId util.ID, transId uint32, msg protocol.ISerializable) error
- func (this *DefaultSession) OnOpen(conn lokas.IConn)
- func (this *DefaultSession) OnRecv(conn lokas.IConn, data []byte)
- func (this *DefaultSession) SendMessage(actorId util.ID, transId uint32, msg protocol.ISerializable) error
- func (this *DefaultSession) SetId(id util.ID)
- func (this *DefaultSession) SetProcess(process lokas.IProcess)
- func (this *DefaultSession) Start() error
- func (this *DefaultSession) Stop() error
- func (this *DefaultSession) Type() string
- func (this *DefaultSession) Update(dt time.Duration, now time.Time)
- func (this *DefaultSession) Write(data []byte) error
- type DefaultSessionManager
- func (this *DefaultSessionManager) AddSession(id util.ID, session lokas.ISession)
- func (this *DefaultSessionManager) Clear()
- func (this *DefaultSessionManager) GetRoundSession() (lokas.ISession, bool)
- func (this *DefaultSessionManager) GetSession(id util.ID) lokas.ISession
- func (this *DefaultSessionManager) GetSessionCount() int
- func (this *DefaultSessionManager) Range(f func(id util.ID, session lokas.ISession) bool)
- func (this *DefaultSessionManager) RemoveSession(id util.ID)
- type SessionOption
Constants ¶
This section is empty.
Variables ¶
View Source
var ContextFinish = errors.New("context finished")
Functions ¶
This section is empty.
Types ¶
type CancelFunc ¶
type CancelFunc func(error)
func WithReasonCancel ¶
func WithReasonCancel(parent context.Context) (ctx context.Context, cancel CancelFunc)
func WithReasonDeadline ¶
func WithReasonTimeout ¶
type DefaultContext ¶
func NewDefaultContext ¶
func NewDefaultContext(ctx context.Context) *DefaultContext
func (*DefaultContext) Cancel ¶
func (this *DefaultContext) Cancel(err error)
func (*DefaultContext) Finish ¶
func (this *DefaultContext) Finish()
func (*DefaultContext) Get ¶
func (this *DefaultContext) Get(name string) interface{}
func (*DefaultContext) GetCallback ¶
func (this *DefaultContext) GetCallback() lokas.AsyncCallBack
func (*DefaultContext) GetProcessIdType ¶
func (this *DefaultContext) GetProcessIdType(key string) util.ProcessId
func (*DefaultContext) GetResp ¶
func (this *DefaultContext) GetResp() interface{}
func (*DefaultContext) GetString ¶
func (this *DefaultContext) GetString(key string) string
func (*DefaultContext) GetTransId ¶
func (this *DefaultContext) GetTransId() uint32
func (*DefaultContext) Set ¶
func (this *DefaultContext) Set(name string, data interface{})
func (*DefaultContext) SetCallback ¶
func (this *DefaultContext) SetCallback(cb lokas.AsyncCallBack)
func (*DefaultContext) SetResp ¶
func (this *DefaultContext) SetResp(data interface{})
type DefaultSession ¶
type DefaultSession struct { util.ID Messages chan []byte Conn lokas.IConn OnCloseFunc func(conn lokas.IConn) OnOpenFunc func(conn lokas.IConn) MsgHandler func(msg *protocol.BinaryMessage) // contains filtered or unexported fields }
func NewDefaultSession ¶
func NewDefaultSession(conn lokas.IConn, id util.ID, manager lokas.ISessionManager, opts ...SessionOption) *DefaultSession
func (*DefaultSession) AsyncCall ¶
func (this *DefaultSession) AsyncCall(actorId util.ID, transId uint32, req protocol.ISerializable, resp protocol.ISerializable) error
func (*DefaultSession) Call ¶
func (this *DefaultSession) Call(actorId util.ID, transId uint32, req protocol.ISerializable, resp protocol.ISerializable) error
func (*DefaultSession) CloneEntity ¶
func (this *DefaultSession) CloneEntity() *ecs.Entity
func (*DefaultSession) GetConn ¶
func (this *DefaultSession) GetConn() lokas.IConn
func (*DefaultSession) GetId ¶
func (this *DefaultSession) GetId() util.ID
func (*DefaultSession) GetProcess ¶
func (this *DefaultSession) GetProcess() lokas.IProcess
func (*DefaultSession) HandleMessage ¶
func (this *DefaultSession) HandleMessage(f func(msg *protocol.BinaryMessage))
func (*DefaultSession) OnClose ¶
func (this *DefaultSession) OnClose(conn lokas.IConn)
func (*DefaultSession) OnCreate ¶
func (this *DefaultSession) OnCreate() error
func (*DefaultSession) OnDestroy ¶
func (this *DefaultSession) OnDestroy() error
func (*DefaultSession) OnMessage ¶
func (this *DefaultSession) OnMessage(actorId util.ID, transId uint32, msg protocol.ISerializable) error
func (*DefaultSession) OnOpen ¶
func (this *DefaultSession) OnOpen(conn lokas.IConn)
func (*DefaultSession) OnRecv ¶
func (this *DefaultSession) OnRecv(conn lokas.IConn, data []byte)
func (*DefaultSession) SendMessage ¶
func (this *DefaultSession) SendMessage(actorId util.ID, transId uint32, msg protocol.ISerializable) error
func (*DefaultSession) SetId ¶
func (this *DefaultSession) SetId(id util.ID)
func (*DefaultSession) SetProcess ¶
func (this *DefaultSession) SetProcess(process lokas.IProcess)
func (*DefaultSession) Start ¶
func (this *DefaultSession) Start() error
func (*DefaultSession) Stop ¶
func (this *DefaultSession) Stop() error
func (*DefaultSession) Type ¶
func (this *DefaultSession) Type() string
func (*DefaultSession) Write ¶
func (this *DefaultSession) Write(data []byte) error
type DefaultSessionManager ¶
type DefaultSessionManager struct {
// contains filtered or unexported fields
}
func NewDefaultSessionManager ¶
func NewDefaultSessionManager(safeMode bool) *DefaultSessionManager
func (*DefaultSessionManager) AddSession ¶
func (this *DefaultSessionManager) AddSession(id util.ID, session lokas.ISession)
func (*DefaultSessionManager) Clear ¶
func (this *DefaultSessionManager) Clear()
func (*DefaultSessionManager) GetRoundSession ¶
func (this *DefaultSessionManager) GetRoundSession() (lokas.ISession, bool)
func (*DefaultSessionManager) GetSession ¶
func (this *DefaultSessionManager) GetSession(id util.ID) lokas.ISession
func (*DefaultSessionManager) GetSessionCount ¶
func (this *DefaultSessionManager) GetSessionCount() int
func (*DefaultSessionManager) Range ¶
func (this *DefaultSessionManager) Range(f func(id util.ID, session lokas.ISession) bool)
func (*DefaultSessionManager) RemoveSession ¶
func (this *DefaultSessionManager) RemoveSession(id util.ID)
type SessionOption ¶
type SessionOption func(*DefaultSession)
func WithCloseFunc ¶
func WithCloseFunc(closeFunc func(conn lokas.IConn)) SessionOption
func WithMsgHandler ¶
func WithMsgHandler(msgHandler func(msg *protocol.BinaryMessage)) SessionOption
func WithOpenFunc ¶
func WithOpenFunc(closeFunc func(conn lokas.IConn)) SessionOption
Click to show internal directories.
Click to hide internal directories.