Documentation ¶
Index ¶
- Constants
- Variables
- func JwtAuth(rsa bool, creator JwtClaimCreator, userCreator UserCreator) ...
- func JwtSign(rsa bool, creator JwtClaimCreator) ...
- func NewModuleFromRegistry(s string) (lokas.IModule, error)
- func RegisterModule(creator Creator)
- func RegisterModulesFromPlugin(path string) error
- func SignToken(creator JwtClaimCreator, user interface{}, a lokas.IProcess, ...) (string, error)
- type ActiveSession
- func (this *ActiveSession) AsyncCall(actorId util.ID, transId uint32, req protocol.ISerializable, ...) error
- func (this *ActiveSession) Call(actorId util.ID, transId uint32, req protocol.ISerializable, ...) error
- func (this *ActiveSession) CloneEntity() *ecs.Entity
- func (this *ActiveSession) GetConn() lokas.IConn
- func (this *ActiveSession) GetId() util.ID
- func (this *ActiveSession) GetProcess() lokas.IProcess
- func (this *ActiveSession) HandleMessage(f func(msg *protocol.BinaryMessage))
- func (this *ActiveSession) OnClose(conn lokas.IConn)
- func (this *ActiveSession) OnCreate() error
- func (this *ActiveSession) OnDestroy() error
- func (this *ActiveSession) OnMessage(actorId util.ID, transId uint32, msg protocol.ISerializable) error
- func (this *ActiveSession) OnOpen(conn lokas.IConn)
- func (this *ActiveSession) OnRecv(conn lokas.IConn, data []byte)
- func (this *ActiveSession) PongHandler(pong *protocol.Pong)
- func (this *ActiveSession) SendMessage(actorId util.ID, transId uint32, msg protocol.ISerializable) error
- func (this *ActiveSession) SetId(id util.ID)
- func (this *ActiveSession) SetProcess(process lokas.IProcess)
- func (this *ActiveSession) Start() error
- func (this *ActiveSession) Stop() error
- func (this *ActiveSession) Type() string
- func (this *ActiveSession) Update(dt time.Duration, now time.Time)
- func (this *ActiveSession) Write(data []byte) error
- type Actor
- func (this *Actor) Call(actorId util.ID, req protocol.ISerializable) (protocol.ISerializable, error)
- func (this *Actor) GetLeaseId() (clientv3.LeaseID, bool, error)
- func (this *Actor) GetProcess() lokas.IProcess
- func (this *Actor) OnMessage(msg *protocol.RouteMessage)
- func (this *Actor) ReceiveMessage(msg *protocol.RouteMessage)
- func (this *Actor) SendMessage(actorId util.ID, transId uint32, msg protocol.ISerializable) error
- func (this *Actor) SendReply(actorId util.ID, transId uint32, msg protocol.ISerializable) error
- func (this *Actor) SetProcess(process lokas.IProcess)
- func (this *Actor) SetType(s string)
- func (this *Actor) StartMessagePump()
- func (this *Actor) Type() string
- func (this *Actor) Update(dt time.Duration, now time.Time)
- type ActorContainer
- func (this *ActorContainer) AddActor(actor lokas.IActor)
- func (this *ActorContainer) GetActor(id util.ID) lokas.IActor
- func (this *ActorContainer) GetActorIds() []util.ID
- func (this *ActorContainer) GetProcess() lokas.IProcess
- func (this *ActorContainer) Load(conf lokas.IConfig) error
- func (this *ActorContainer) OnStart() error
- func (this *ActorContainer) OnStop() error
- func (this *ActorContainer) RemoveActor(actor lokas.IActor)
- func (this *ActorContainer) RemoveActorById(id util.ID) lokas.IActor
- func (this *ActorContainer) SetProcess(process lokas.IProcess)
- func (this *ActorContainer) Start() *promise.Promise
- func (this *ActorContainer) StartActor(actor lokas.IActor)
- func (this *ActorContainer) Stop() *promise.Promise
- func (this *ActorContainer) StopActor(actor lokas.IActor)
- func (this *ActorContainer) Type() string
- func (this *ActorContainer) Unload() error
- type ActorRegistry
- type ActorRegistryInfo
- type AppConfig
- func (this *AppConfig) AllSettings() map[string]interface{}
- func (this *AppConfig) Get(key string) interface{}
- func (this *AppConfig) GetBool(key string) bool
- func (this *AppConfig) GetDuration(key string) time.Duration
- func (this *AppConfig) GetFloat64(key string) float64
- func (this *AppConfig) GetFolder() string
- func (this *AppConfig) GetInt(key string) int
- func (this *AppConfig) GetIntSlice(key string) []int
- func (this *AppConfig) GetSizeInBytes(key string) uint
- func (this *AppConfig) GetString(key string) string
- func (this *AppConfig) GetStringMap(key string) map[string]interface{}
- func (this *AppConfig) GetStringMapString(key string) map[string]string
- func (this *AppConfig) GetStringMapStringSlice(key string) map[string][]string
- func (this *AppConfig) GetStringSlice(key string) []string
- func (this *AppConfig) GetTime(key string) time.Time
- func (this *AppConfig) IsSet(key string) bool
- func (this *AppConfig) Load() error
- func (this *AppConfig) LoadFromRemote() error
- func (this *AppConfig) Save() error
- func (this *AppConfig) Set(key string, value interface{})
- func (this *AppConfig) SetFolder(f string)
- func (this *AppConfig) SetRemoteConfig(p string, etcd string)
- func (this *AppConfig) Sub(key string) lokas.IConfig
- type Avatar
- func (this *Avatar) Deserialize(a lokas.IProcess) error
- func (this *Avatar) Load(conf lokas.IConfig) error
- func (this *Avatar) OnStart() error
- func (this *Avatar) OnStop() error
- func (this *Avatar) Serialize(a lokas.IProcess) error
- func (this *Avatar) Start() *promise.Promise
- func (this *Avatar) Stop() *promise.Promise
- func (this *Avatar) Unload() error
- type AvatarManager
- func (this *AvatarManager) CreateAvatar(id util.ID) (*Avatar, error)
- func (this *AvatarManager) GetAvatar(id util.ID) *Avatar
- func (this *AvatarManager) Load(conf lokas.IConfig) error
- func (this *AvatarManager) OnStart() error
- func (this *AvatarManager) OnStop() error
- func (this *AvatarManager) OnUpdate()
- func (this *AvatarManager) RemoveAvatar(id util.ID)
- func (this *AvatarManager) Start() *promise.Promise
- func (this *AvatarManager) Stop() *promise.Promise
- func (this *AvatarManager) Unload() error
- type Block
- type Cell
- type CellManager
- type Center
- func (this *Center) Load(conf lokas.IConfig) error
- func (this *Center) OnCreate() error
- func (this *Center) OnDestroy() error
- func (this *Center) OnRegister()
- func (this *Center) OnStart() error
- func (this *Center) OnStop() error
- func (this *Center) Start() *promise.Promise
- func (this *Center) Stop() *promise.Promise
- func (this *Center) Unload() error
- type CommonRegistry
- func (this *CommonRegistry) AddActor(actor *ActorRegistry)
- func (this *CommonRegistry) AddProcess(process *ProcessRegistry)
- func (this *CommonRegistry) AddService(service *ServiceRegistry)
- func (this *CommonRegistry) GetActorIdsByTypeAndServerId(serverId int32, typ string) []util.ID
- func (this *CommonRegistry) GetActorRegistry(id util.ID) *ActorRegistry
- func (this *CommonRegistry) RemoveActor(actorId util.ID)
- func (this *CommonRegistry) RemoveProcess(id util.ProcessId)
- func (this *CommonRegistry) RemoveService(id protocol.BINARY_TAG)
- type ConfigOption
- type ConnType
- type Context
- type Creator
- type DefaultConfig
- func (this *DefaultConfig) GetAllSub() []lokas.IConfig
- func (this *DefaultConfig) GetDb(t string) interface{}
- func (this *DefaultConfig) GetGameId() string
- func (this *DefaultConfig) GetIdType(key string) util.ID
- func (this *DefaultConfig) GetName() string
- func (this *DefaultConfig) GetProcessId() util.ProcessId
- func (this *DefaultConfig) GetProcessIdType(key string) util.ProcessId
- func (this *DefaultConfig) GetServerId() int32
- func (this *DefaultConfig) GetVersion() string
- func (this *DefaultConfig) Load() error
- func (this *DefaultConfig) LoadFromRemote() error
- func (this *DefaultConfig) LoadFromString(s string) error
- func (this *DefaultConfig) ServerName() string
- type EtcdConfig
- type Gate
- func (this *Gate) Load(conf lokas.IConfig) error
- func (this *Gate) OnCreate() error
- func (this *Gate) OnDestroy() error
- func (this *Gate) OnStart() error
- func (this *Gate) OnStop() error
- func (this *Gate) SessionCreator(conn lokas.IConn) lokas.ISession
- func (this *Gate) Start() *promise.Promise
- func (this *Gate) Stop() *promise.Promise
- func (this *Gate) Unload() error
- type Http
- func (this *Http) CreateHandlerFunc(f rox.Handler) func(http.ResponseWriter, *http.Request)
- func (this *Http) HandleFunc(path string, f rox.Handler) *rox.Route
- func (this *Http) Load(conf lokas.IConfig) error
- func (this *Http) MatchRouter(s string) *rox.Router
- func (this *Http) OnCreate() error
- func (this *Http) OnDestroy() error
- func (this *Http) OnStart() error
- func (this *Http) OnStop() error
- func (this *Http) Path(s string) *rox.Route
- func (this *Http) PathExcept(p string, m ...rox.MiddleWare) *Http
- func (this *Http) PathExcepts(p []string, m ...rox.MiddleWare) *Http
- func (this *Http) PathIn(p []string, m ...rox.MiddleWare) *Http
- func (this *Http) PathOnly(p string, m ...rox.MiddleWare) *Http
- func (this *Http) PathPrefix(s string) *rox.Route
- func (this *Http) PrefixExcept(prefix string, m ...rox.MiddleWare) *Http
- func (this *Http) PrefixExceptStrict(prefix string, m ...rox.MiddleWare) *Http
- func (this *Http) PrefixOnly(prefix string, m ...rox.MiddleWare) *Http
- func (this *Http) PrefixOnlyStrict(prefix string, m ...rox.MiddleWare) *Http
- func (this *Http) Start() *promise.Promise
- func (this *Http) Stop() *promise.Promise
- func (this *Http) Unload() error
- func (this *Http) Use(m ...rox.MiddleWare) *Http
- func (this *Http) When(matcher rox.MiddlewareMatcher, m ...rox.MiddleWare) *Http
- type JwtClaim
- type JwtClaimCreator
- type JwtClaimWithUser
- type MongoConfig
- type MysqlConfig
- type PassiveSession
- func (this *PassiveSession) GetConn() lokas.IConn
- func (this *PassiveSession) Load(conf lokas.IConfig) error
- func (this *PassiveSession) OnClose(conn lokas.IConn)
- func (this *PassiveSession) OnCreate() error
- func (this *PassiveSession) OnDestroy() error
- func (this *PassiveSession) OnOpen(conn lokas.IConn)
- func (this *PassiveSession) OnRecv(conn lokas.IConn, data []byte)
- func (this *PassiveSession) OnStart() error
- func (this *PassiveSession) OnStop() error
- func (this *PassiveSession) Start() *promise.Promise
- func (this *PassiveSession) StartMessagePump()
- func (this *PassiveSession) Stop() *promise.Promise
- func (this *PassiveSession) Unload() error
- type Process
- func (this *Process) Add(mod lokas.IModule) lokas.IModule
- func (this *Process) Config() lokas.IConfig
- func (this *Process) GameId() string
- func (this *Process) GameServerId() string
- func (this *Process) GenId() util.ID
- func (this *Process) Get(name string) lokas.IModule
- func (this *Process) GetEtcd() *etcdclient.Client
- func (this *Process) GetLogger() *log.ComposeLogger
- func (this *Process) GetMongo() *qmgo.Database
- func (this *Process) GetRedis() *redisclient.Client
- func (this *Process) GlobalMutex(key string, ttl int) (*etcdclient.Mutex, error)
- func (this *Process) Id() util.ProcessId
- func (this *Process) Load(config lokas.IProcessConfig) error
- func (this *Process) LoadAllModule(conf lokas.IProcessConfig) error
- func (this *Process) LoadMod(name string, conf lokas.IConfig) error
- func (this *Process) LoadModuleRegistry() error
- func (this *Process) RegisterModule(creator lokas.IModuleCtor)
- func (this *Process) SaveModuleRegistry() error
- func (this *Process) ServerId() int32
- func (this *Process) Start() error
- func (this *Process) StartAllModule() error
- func (this *Process) Stop() error
- func (this *Process) StopAllModule() error
- func (this *Process) UnloadMod(name string) error
- func (this *Process) Version() string
- type ProcessActorsInfo
- type ProcessRegistry
- type ProcessRegistryInfo
- type ProcessServiceInfo
- type Proxy
- func (this *Proxy) Connect(id util.ProcessId, addr string) error
- func (this *Proxy) Load(conf lokas.IConfig) error
- func (this *Proxy) OnCreate() error
- func (this *Proxy) OnDestroy() error
- func (this *Proxy) OnStart() error
- func (this *Proxy) OnStop() error
- func (this *Proxy) Start() *promise.Promise
- func (this *Proxy) Stop() *promise.Promise
- func (this *Proxy) Type() string
- func (this *Proxy) Unload() error
- type RedisConfig
- type Registry
- func (this *Registry) GetActorIdsByTypeAndServerId(serverId int32, typ string) []util.ID
- func (this *Registry) GetProcess() lokas.IProcess
- func (this *Registry) GetProcessIdByActor(actorId util.ID) (util.ProcessId, error)
- func (this *Registry) Load(conf lokas.IConfig) error
- func (this *Registry) OnCreate() error
- func (this *Registry) OnDestroy() error
- func (this *Registry) OnStart() error
- func (this *Registry) OnStop() error
- func (this *Registry) QueryRemoteActorsByServer(typ string, ServerId int32) []*Actor
- func (this *Registry) QueryRemoteActorsByType(typ string) []*Actor
- func (this *Registry) RegisterActorLocal(actor lokas.IActor) error
- func (this *Registry) RegisterActorRemote(actor lokas.IActor) error
- func (this *Registry) RegisterActors() error
- func (this *Registry) RegisterProcessInfo() error
- func (this *Registry) RegisterServiceLocal(service *lokas.Service) error
- func (this *Registry) RegisterServiceRemote(service *lokas.Service) error
- func (this *Registry) RegistryServices()
- func (this *Registry) SetProcess(process lokas.IProcess)
- func (this *Registry) Start() *promise.Promise
- func (this *Registry) Stop() *promise.Promise
- func (this *Registry) Type() string
- func (this *Registry) Unload() error
- func (this *Registry) UnregisterActorLocal(actor lokas.IActor) error
- func (this *Registry) UnregisterActorRemote(actor lokas.IActor) error
- func (this *Registry) UnregisterServiceLocal(service *lokas.Service) error
- func (this *Registry) UnregisterServiceRemote(service *lokas.Service) error
- type Router
- func (this *Router) GetProcess() lokas.IProcess
- func (this *Router) Load(conf lokas.IConfig) error
- func (this *Router) OnStart() error
- func (this *Router) OnStop() error
- func (this *Router) RouteMsg(msg *protocol.RouteMessage)
- func (this *Router) SetProcess(process lokas.IProcess)
- func (this *Router) Start() *promise.Promise
- func (this *Router) Stop() *promise.Promise
- func (this *Router) Type() string
- func (this *Router) Unload() error
- type ServiceRegistry
- type SessionOption
- type TcpClient
- func (this *TcpClient) Call(transId uint32, req interface{}) (interface{}, error)
- func (this *TcpClient) ClearContext(err error)
- func (this *TcpClient) Connect(addr string) *promise.Promise
- func (this *TcpClient) Connected() bool
- func (this *TcpClient) Disconnect(b bool) *promise.Promise
- func (this *TcpClient) GetContext(transId uint32) lokas.IReqContext
- func (this *TcpClient) MessageHandler(msg *protocol.BinaryMessage)
- func (this *TcpClient) Off(cmdId uint16, listener events.Listener)
- func (this *TcpClient) OnClose(conn lokas.IConn)
- func (this *TcpClient) OnMessage(cmdId protocol.BINARY_TAG, listeners ...events.Listener)
- func (this *TcpClient) OnOpen(conn lokas.IConn)
- func (this *TcpClient) OnRecvCmd(cmdId protocol.BINARY_TAG, time time.Duration) *promise.Promise
- func (this *TcpClient) Request(req interface{}) *promise.Promise
- func (this *TcpClient) SendMessage(transId uint32, msg interface{})
- type User
- type UserCreator
Constants ¶
View Source
const ( TimeOut = time.Second * 15 UpdateTime = time.Second * 15 LeaseDuration int64 = 23 LeaseRenewDuration int64 = 15 )
View Source
const ( TAG_User = 70 TAG_JWT = 71 )
View Source
const (
PingInterval = time.Second * 3
)
View Source
const REFRESH_TOKEN_EXPIRE_TIME = time.Hour * 24 * 30
View Source
const TOKEN_EXPIRE_TIME = time.Minute * 10
Variables ¶
View Source
var AvatarManagerCtor = avatarManagerCtor{}
View Source
var CenterCtor = centerCtor{}
View Source
var GateCtor = gateCtor{}
View Source
var HttpCtor = httpCtor{}
View Source
var ProxyCtor = proxyCtor{}
Functions ¶
func JwtAuth ¶
func JwtAuth(rsa bool, creator JwtClaimCreator, userCreator UserCreator) func(w rox.ResponseWriter, r *http.Request, a lokas.IProcess, next http.Handler)
func JwtSign ¶
func JwtSign(rsa bool, creator JwtClaimCreator) func(w rox.ResponseWriter, r *http.Request, a lokas.IProcess, next http.Handler)
func NewModuleFromRegistry ¶
func RegisterModule ¶
func RegisterModule(creator Creator)
Types ¶
type ActiveSession ¶ added in v0.0.6
type ActiveSession struct { util.ID Messages chan []byte Conn lokas.IConn Protocol protocol.TYPE OnCloseFunc func(conn lokas.IConn) OnOpenFunc func(conn lokas.IConn) MsgHandler func(msg *protocol.BinaryMessage) // contains filtered or unexported fields }
func NewActiveSession ¶ added in v0.0.6
func NewActiveSession(conn lokas.IConn, id util.ID, manager lokas.ISessionManager, opts ...SessionOption) *ActiveSession
func (*ActiveSession) AsyncCall ¶ added in v0.0.6
func (this *ActiveSession) AsyncCall(actorId util.ID, transId uint32, req protocol.ISerializable, resp protocol.ISerializable) error
func (*ActiveSession) Call ¶ added in v0.0.6
func (this *ActiveSession) Call(actorId util.ID, transId uint32, req protocol.ISerializable, resp protocol.ISerializable) error
func (*ActiveSession) CloneEntity ¶ added in v0.0.6
func (this *ActiveSession) CloneEntity() *ecs.Entity
func (*ActiveSession) GetConn ¶ added in v0.0.6
func (this *ActiveSession) GetConn() lokas.IConn
func (*ActiveSession) GetId ¶ added in v0.0.6
func (this *ActiveSession) GetId() util.ID
func (*ActiveSession) GetProcess ¶ added in v0.0.6
func (this *ActiveSession) GetProcess() lokas.IProcess
func (*ActiveSession) HandleMessage ¶ added in v0.0.6
func (this *ActiveSession) HandleMessage(f func(msg *protocol.BinaryMessage))
func (*ActiveSession) OnClose ¶ added in v0.0.6
func (this *ActiveSession) OnClose(conn lokas.IConn)
func (*ActiveSession) OnCreate ¶ added in v0.0.6
func (this *ActiveSession) OnCreate() error
func (*ActiveSession) OnDestroy ¶ added in v0.0.6
func (this *ActiveSession) OnDestroy() error
func (*ActiveSession) OnMessage ¶ added in v0.0.6
func (this *ActiveSession) OnMessage(actorId util.ID, transId uint32, msg protocol.ISerializable) error
func (*ActiveSession) OnOpen ¶ added in v0.0.6
func (this *ActiveSession) OnOpen(conn lokas.IConn)
func (*ActiveSession) OnRecv ¶ added in v0.0.6
func (this *ActiveSession) OnRecv(conn lokas.IConn, data []byte)
func (*ActiveSession) PongHandler ¶ added in v0.0.6
func (this *ActiveSession) PongHandler(pong *protocol.Pong)
func (*ActiveSession) SendMessage ¶ added in v0.0.6
func (this *ActiveSession) SendMessage(actorId util.ID, transId uint32, msg protocol.ISerializable) error
func (*ActiveSession) SetId ¶ added in v0.0.6
func (this *ActiveSession) SetId(id util.ID)
func (*ActiveSession) SetProcess ¶ added in v0.0.6
func (this *ActiveSession) SetProcess(process lokas.IProcess)
func (*ActiveSession) Start ¶ added in v0.0.6
func (this *ActiveSession) Start() error
func (*ActiveSession) Stop ¶ added in v0.0.6
func (this *ActiveSession) Stop() error
func (*ActiveSession) Type ¶ added in v0.0.6
func (this *ActiveSession) Type() string
func (*ActiveSession) Update ¶ added in v0.0.6
func (this *ActiveSession) Update(dt time.Duration, now time.Time)
func (*ActiveSession) Write ¶ added in v0.0.6
func (this *ActiveSession) Write(data []byte) error
type Actor ¶
type Actor struct { lokas.IEntity OnUpdateFunc func() MsgHandler func(actorId util.ID, transId uint32, msg protocol.ISerializable) (protocol.ISerializable, error) // contains filtered or unexported fields }
func (*Actor) Call ¶
func (this *Actor) Call(actorId util.ID, req protocol.ISerializable) (protocol.ISerializable, error)
func (*Actor) GetLeaseId ¶
return leaseId,(bool)is registered,error
func (*Actor) GetProcess ¶
func (this *Actor) GetProcess() lokas.IProcess
func (*Actor) OnMessage ¶
func (this *Actor) OnMessage(msg *protocol.RouteMessage)
func (*Actor) ReceiveMessage ¶
func (this *Actor) ReceiveMessage(msg *protocol.RouteMessage)
func (*Actor) SendMessage ¶
func (*Actor) SetProcess ¶
func (this *Actor) SetProcess(process lokas.IProcess)
func (*Actor) StartMessagePump ¶
func (this *Actor) StartMessagePump()
type ActorContainer ¶
type ActorContainer struct { Actors map[util.ID]lokas.IActor // contains filtered or unexported fields }
func NewActorContainer ¶
func NewActorContainer(process lokas.IProcess) *ActorContainer
func (*ActorContainer) AddActor ¶
func (this *ActorContainer) AddActor(actor lokas.IActor)
func (*ActorContainer) GetActor ¶
func (this *ActorContainer) GetActor(id util.ID) lokas.IActor
func (*ActorContainer) GetActorIds ¶
func (this *ActorContainer) GetActorIds() []util.ID
func (*ActorContainer) GetProcess ¶
func (this *ActorContainer) GetProcess() lokas.IProcess
func (*ActorContainer) Load ¶
func (this *ActorContainer) Load(conf lokas.IConfig) error
func (*ActorContainer) OnStart ¶
func (this *ActorContainer) OnStart() error
func (*ActorContainer) OnStop ¶
func (this *ActorContainer) OnStop() error
func (*ActorContainer) RemoveActor ¶
func (this *ActorContainer) RemoveActor(actor lokas.IActor)
func (*ActorContainer) RemoveActorById ¶
func (this *ActorContainer) RemoveActorById(id util.ID) lokas.IActor
func (*ActorContainer) SetProcess ¶
func (this *ActorContainer) SetProcess(process lokas.IProcess)
func (*ActorContainer) Start ¶
func (this *ActorContainer) Start() *promise.Promise
func (*ActorContainer) StartActor ¶
func (this *ActorContainer) StartActor(actor lokas.IActor)
func (*ActorContainer) Stop ¶
func (this *ActorContainer) Stop() *promise.Promise
func (*ActorContainer) StopActor ¶
func (this *ActorContainer) StopActor(actor lokas.IActor)
func (*ActorContainer) Type ¶
func (this *ActorContainer) Type() string
func (*ActorContainer) Unload ¶
func (this *ActorContainer) Unload() error
type ActorRegistry ¶
type ActorRegistry struct { Id util.ID ProcessId util.ProcessId Type string GameId string Version string ServerId int32 //Health lokas.ActorState Ts time.Time }
func NewActorRegistry ¶
func NewActorRegistry(id util.ID) *ActorRegistry
type ActorRegistryInfo ¶
type ActorRegistryInfo struct { Id util.ID Type string ProcessId util.ProcessId GameId string Version string ServerId int32 Ts time.Time }
func CreateActorRegistryInfo ¶
func CreateActorRegistryInfo(actor lokas.IActor) *ActorRegistryInfo
type AppConfig ¶
func NewAppConfig ¶
func NewAppConfig(name string, opts ...ConfigOption) *AppConfig
func NewSubAppConfig ¶
func (*AppConfig) AllSettings ¶
func (*AppConfig) GetFloat64 ¶
func (*AppConfig) GetIntSlice ¶
func (*AppConfig) GetSizeInBytes ¶
func (*AppConfig) GetStringMap ¶
func (*AppConfig) GetStringMapString ¶
func (*AppConfig) GetStringMapStringSlice ¶
func (*AppConfig) GetStringSlice ¶
func (*AppConfig) LoadFromRemote ¶
func (*AppConfig) SetRemoteConfig ¶
type AvatarManager ¶
type AvatarManager struct { *Actor Avatars map[util.ID]*Avatar // contains filtered or unexported fields }
func (*AvatarManager) CreateAvatar ¶
func (this *AvatarManager) CreateAvatar(id util.ID) (*Avatar, error)
func (*AvatarManager) Load ¶
func (this *AvatarManager) Load(conf lokas.IConfig) error
func (*AvatarManager) OnStart ¶
func (this *AvatarManager) OnStart() error
func (*AvatarManager) OnStop ¶
func (this *AvatarManager) OnStop() error
func (*AvatarManager) OnUpdate ¶
func (this *AvatarManager) OnUpdate()
func (*AvatarManager) RemoveAvatar ¶
func (this *AvatarManager) RemoveAvatar(id util.ID)
func (*AvatarManager) Start ¶
func (this *AvatarManager) Start() *promise.Promise
func (*AvatarManager) Stop ¶
func (this *AvatarManager) Stop() *promise.Promise
func (*AvatarManager) Unload ¶
func (this *AvatarManager) Unload() error
type CellManager ¶
type CellManager struct { *Actor ActorContainer Blocks map[int64]Block }
func (*CellManager) Load ¶
func (this *CellManager) Load(conf lokas.IConfig) error
func (*CellManager) OnStart ¶
func (this *CellManager) OnStart() error
func (*CellManager) OnStop ¶
func (this *CellManager) OnStop() error
func (*CellManager) Spawn ¶
func (this *CellManager) Spawn() lokas.IActor
func (*CellManager) Unload ¶
func (this *CellManager) Unload() error
type Center ¶
func (*Center) OnRegister ¶
func (this *Center) OnRegister()
type CommonRegistry ¶
type CommonRegistry struct { Processes map[util.ProcessId]*ProcessRegistry Service map[protocol.BINARY_TAG]*ServiceRegistry Actors map[util.ID]*ActorRegistry ActorsByType map[string][]util.ID ActorsByServer map[int32][]util.ID Ts time.Time // contains filtered or unexported fields }
func NewCommonRegistry ¶
func NewCommonRegistry() *CommonRegistry
func (*CommonRegistry) AddActor ¶
func (this *CommonRegistry) AddActor(actor *ActorRegistry)
func (*CommonRegistry) AddProcess ¶
func (this *CommonRegistry) AddProcess(process *ProcessRegistry)
func (*CommonRegistry) AddService ¶
func (this *CommonRegistry) AddService(service *ServiceRegistry)
func (*CommonRegistry) GetActorIdsByTypeAndServerId ¶
func (this *CommonRegistry) GetActorIdsByTypeAndServerId(serverId int32, typ string) []util.ID
func (*CommonRegistry) GetActorRegistry ¶
func (this *CommonRegistry) GetActorRegistry(id util.ID) *ActorRegistry
func (*CommonRegistry) RemoveActor ¶
func (this *CommonRegistry) RemoveActor(actorId util.ID)
func (*CommonRegistry) RemoveProcess ¶
func (this *CommonRegistry) RemoveProcess(id util.ProcessId)
func (*CommonRegistry) RemoveService ¶
func (this *CommonRegistry) RemoveService(id protocol.BINARY_TAG)
type ConfigOption ¶
func ConfigFile ¶
func ConfigFile(folder string) ConfigOption
func EtcdFile ¶
func EtcdFile(etcdPath string, addr string) ConfigOption
func MongoFile ¶
func MongoFile(folder string) ConfigOption
type Context ¶
type Context struct {
Content map[string]interface{} `json:"content"`
}
func NewContext ¶
func NewContext() *Context
type DefaultConfig ¶
type DefaultConfig struct { *AppConfig ProcessId util.ProcessId `mapstructure:"pid"` ServerId int32 `mapstructure:"sid"` GameId string `mapstructure:"gid"` Version string `mapstructure:"version"` SName string `mapstructure:"serverName"` Name string `mapstructure:"name"` Type string `mapstructure:"type"` Host string `mapstructure:"host"` Port string `mapstructure:"port"` Etcd EtcdConfig `mapstructure:"-"` Mongo MongoConfig `mapstructure:"-"` Mysql MysqlConfig `mapstructure:"-"` Redis RedisConfig `mapstructure:"-"` Mods []lokas.IConfig `mapstructure:"-"` Modules []string `mapstructure:"modules"` }
func NewDefaultConfig ¶
func NewDefaultConfig() *DefaultConfig
func (*DefaultConfig) GetAllSub ¶
func (this *DefaultConfig) GetAllSub() []lokas.IConfig
func (*DefaultConfig) GetDb ¶
func (this *DefaultConfig) GetDb(t string) interface{}
func (*DefaultConfig) GetGameId ¶
func (this *DefaultConfig) GetGameId() string
func (*DefaultConfig) GetName ¶
func (this *DefaultConfig) GetName() string
func (*DefaultConfig) GetProcessId ¶
func (this *DefaultConfig) GetProcessId() util.ProcessId
func (*DefaultConfig) GetProcessIdType ¶
func (this *DefaultConfig) GetProcessIdType(key string) util.ProcessId
func (*DefaultConfig) GetServerId ¶
func (this *DefaultConfig) GetServerId() int32
func (*DefaultConfig) GetVersion ¶
func (this *DefaultConfig) GetVersion() string
func (*DefaultConfig) Load ¶
func (this *DefaultConfig) Load() error
func (*DefaultConfig) LoadFromRemote ¶
func (this *DefaultConfig) LoadFromRemote() error
func (*DefaultConfig) LoadFromString ¶
func (this *DefaultConfig) LoadFromString(s string) error
func (*DefaultConfig) ServerName ¶
func (this *DefaultConfig) ServerName() string
type EtcdConfig ¶
type EtcdConfig struct {
EndPoints []string `mapstructure:"endpoints"`
}
type Gate ¶
type Gate struct { *Actor lokas.ISessionManager Host string Port string AuthFunc func(data []byte) error SessionCreatorFunc func(conn lokas.IConn) lokas.ISession Protocol protocol.TYPE // contains filtered or unexported fields }
func (*Gate) SessionCreator ¶
func (this *Gate) SessionCreator(conn lokas.IConn) lokas.ISession
type Http ¶
func (*Http) CreateHandlerFunc ¶
func (*Http) PathExcept ¶
func (this *Http) PathExcept(p string, m ...rox.MiddleWare) *Http
func (*Http) PathExcepts ¶
func (this *Http) PathExcepts(p []string, m ...rox.MiddleWare) *Http
func (*Http) PrefixExcept ¶
func (this *Http) PrefixExcept(prefix string, m ...rox.MiddleWare) *Http
func (*Http) PrefixExceptStrict ¶
func (this *Http) PrefixExceptStrict(prefix string, m ...rox.MiddleWare) *Http
func (*Http) PrefixOnly ¶
func (this *Http) PrefixOnly(prefix string, m ...rox.MiddleWare) *Http
func (*Http) PrefixOnlyStrict ¶
func (this *Http) PrefixOnlyStrict(prefix string, m ...rox.MiddleWare) *Http
func (*Http) When ¶
func (this *Http) When(matcher rox.MiddlewareMatcher, m ...rox.MiddleWare) *Http
type JwtClaim ¶
func NewJwtClaim ¶
type JwtClaimCreator ¶
type JwtClaimCreator func(user interface{}, expire time.Duration) JwtClaimWithUser
type JwtClaimWithUser ¶
type JwtClaimWithUser interface { jwt.Claims GetUser() interface{} SetUser(user interface{}) }
type MongoConfig ¶
type MysqlConfig ¶
type PassiveSession ¶ added in v0.0.6
type PassiveSession struct { *Actor Verified bool Messages chan []byte Conn lokas.IConn Protocol protocol.TYPE OnCloseFunc func(conn lokas.IConn) OnOpenFunc func(conn lokas.IConn) ClientMsgHandler func(msg *protocol.BinaryMessage) AuthFunc func(data []byte) error // contains filtered or unexported fields }
func NewPassiveSession ¶ added in v0.0.6
func NewPassiveSession(conn lokas.IConn, id util.ID, manager lokas.ISessionManager) *PassiveSession
func (*PassiveSession) GetConn ¶ added in v0.0.6
func (this *PassiveSession) GetConn() lokas.IConn
func (*PassiveSession) Load ¶ added in v0.0.6
func (this *PassiveSession) Load(conf lokas.IConfig) error
func (*PassiveSession) OnClose ¶ added in v0.0.6
func (this *PassiveSession) OnClose(conn lokas.IConn)
func (*PassiveSession) OnCreate ¶ added in v0.0.6
func (this *PassiveSession) OnCreate() error
func (*PassiveSession) OnDestroy ¶ added in v0.0.6
func (this *PassiveSession) OnDestroy() error
func (*PassiveSession) OnOpen ¶ added in v0.0.6
func (this *PassiveSession) OnOpen(conn lokas.IConn)
func (*PassiveSession) OnRecv ¶ added in v0.0.6
func (this *PassiveSession) OnRecv(conn lokas.IConn, data []byte)
func (*PassiveSession) OnStart ¶ added in v0.0.6
func (this *PassiveSession) OnStart() error
func (*PassiveSession) OnStop ¶ added in v0.0.6
func (this *PassiveSession) OnStop() error
func (*PassiveSession) Start ¶ added in v0.0.6
func (this *PassiveSession) Start() *promise.Promise
func (*PassiveSession) StartMessagePump ¶ added in v0.0.6
func (this *PassiveSession) StartMessagePump()
func (*PassiveSession) Stop ¶ added in v0.0.6
func (this *PassiveSession) Stop() *promise.Promise
func (*PassiveSession) Unload ¶ added in v0.0.6
func (this *PassiveSession) Unload() error
type Process ¶
type Process struct { lokas.IActorContainer lokas.IRegistry lokas.IRouter // contains filtered or unexported fields }
func CreateProcess ¶
func CreateProcess() *Process
func (*Process) GameServerId ¶
func (*Process) GetEtcd ¶
func (this *Process) GetEtcd() *etcdclient.Client
func (*Process) GetLogger ¶
func (this *Process) GetLogger() *log.ComposeLogger
func (*Process) GetRedis ¶
func (this *Process) GetRedis() *redisclient.Client
func (*Process) GlobalMutex ¶
func (*Process) LoadAllModule ¶
func (*Process) LoadModuleRegistry ¶
func (*Process) RegisterModule ¶
func (this *Process) RegisterModule(creator lokas.IModuleCtor)
func (*Process) SaveModuleRegistry ¶
func (*Process) StartAllModule ¶
func (*Process) StopAllModule ¶
type ProcessActorsInfo ¶
func CreateProcessActorsInfo ¶
func CreateProcessActorsInfo(process lokas.IProcess) *ProcessActorsInfo
type ProcessRegistry ¶
type ProcessRegistry struct { Id util.ProcessId GameId string Version string ServerId int32 Host string Port string Services map[protocol.BINARY_TAG]*lokas.Service Actors map[util.ID]*ActorRegistry Ts time.Time }
func NewProcessRegistry ¶
func NewProcessRegistry(id util.ProcessId) *ProcessRegistry
type ProcessRegistryInfo ¶
type ProcessRegistryInfo struct { Id util.ProcessId GameId string Version string ServerId int32 Host string Port string Ts time.Time }
func CreateProcessRegistryInfo ¶
func CreateProcessRegistryInfo(process lokas.IProcess) *ProcessRegistryInfo
type ProcessServiceInfo ¶
type ProcessServiceInfo struct { Id util.ProcessId Services map[protocol.BINARY_TAG]int }
type Proxy ¶
type RedisConfig ¶
type Registry ¶
type Registry struct { LocalRegistry *CommonRegistry //local actor&service registry GlobalRegistry *CommonRegistry //local actor&service registry // contains filtered or unexported fields }
func NewRegistry ¶
func NewRegistry(process lokas.IProcess) *Registry
func (*Registry) GetActorIdsByTypeAndServerId ¶
func (*Registry) GetProcess ¶
func (this *Registry) GetProcess() lokas.IProcess
func (*Registry) GetProcessIdByActor ¶
func (*Registry) QueryRemoteActorsByServer ¶
func (*Registry) QueryRemoteActorsByType ¶
func (*Registry) RegisterActorLocal ¶
func (*Registry) RegisterActorRemote ¶
func (*Registry) RegisterActors ¶
func (*Registry) RegisterProcessInfo ¶
func (*Registry) RegisterServiceLocal ¶
TODO
func (*Registry) RegisterServiceRemote ¶
func (*Registry) RegistryServices ¶
func (this *Registry) RegistryServices()
func (*Registry) SetProcess ¶
func (this *Registry) SetProcess(process lokas.IProcess)
func (*Registry) UnregisterActorLocal ¶
func (*Registry) UnregisterActorRemote ¶
func (*Registry) UnregisterServiceLocal ¶
func (*Registry) UnregisterServiceRemote ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
router读取配置表,同步服务器注册信息 路由信息到本机或调用Proxy建立连接
func (*Router) GetProcess ¶
func (this *Router) GetProcess() lokas.IProcess
func (*Router) RouteMsg ¶
func (this *Router) RouteMsg(msg *protocol.RouteMessage)
func (*Router) SetProcess ¶
func (this *Router) SetProcess(process lokas.IProcess)
type ServiceRegistry ¶
type SessionOption ¶
type SessionOption func(*ActiveSession)
type TcpClient ¶ added in v0.0.6
type TcpClient struct { events.EventEmmiter *ActiveSession Closing bool Opening bool Protocol protocol.TYPE // contains filtered or unexported fields }
func NewTcpClient ¶ added in v0.0.6
func NewTcpClient() *TcpClient
func (*TcpClient) ClearContext ¶ added in v0.0.6
func (*TcpClient) Disconnect ¶ added in v0.0.6
func (*TcpClient) GetContext ¶ added in v0.0.8
func (*TcpClient) MessageHandler ¶ added in v0.0.6
func (this *TcpClient) MessageHandler(msg *protocol.BinaryMessage)
func (*TcpClient) OnMessage ¶ added in v0.0.6
func (this *TcpClient) OnMessage(cmdId protocol.BINARY_TAG, listeners ...events.Listener)
func (*TcpClient) SendMessage ¶ added in v0.0.6
type UserCreator ¶
type UserCreator func() interface{}
Click to show internal directories.
Click to hide internal directories.