1
This commit is contained in:
parent
e4b1bd4038
commit
3de0068376
@ -1,11 +1,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"cs"
|
||||
"f5"
|
||||
"mt"
|
||||
"q5"
|
||||
"ss"
|
||||
)
|
||||
|
||||
type App struct {
|
||||
|
@ -5,28 +5,28 @@ import (
|
||||
"mtb"
|
||||
)
|
||||
|
||||
type IMCluster struct {
|
||||
mtb.IMCluster
|
||||
type AdminCluster struct {
|
||||
mtb.AdminCluster
|
||||
}
|
||||
|
||||
type IMClusterTable struct {
|
||||
f5.IdMetaTable[IMCluster]
|
||||
selfConf *IMCluster
|
||||
type AdminClusterTable struct {
|
||||
f5.IdMetaTable[AdminCluster]
|
||||
selfConf *AdminCluster
|
||||
}
|
||||
|
||||
func (this *IMCluster) Init1() {
|
||||
func (this *AdminCluster) Init1() {
|
||||
|
||||
}
|
||||
|
||||
func (this *IMClusterTable) GetListenPort() int32 {
|
||||
func (this *AdminClusterTable) GetListenPort() int32 {
|
||||
return this.selfConf.GetListenPort()
|
||||
}
|
||||
|
||||
func (this *IMClusterTable) GetHttpListenPort() int32 {
|
||||
func (this *AdminClusterTable) GetHttpListenPort() int32 {
|
||||
return this.selfConf.GetHttpListenPort()
|
||||
}
|
||||
|
||||
func (this *IMClusterTable) PostInit1() {
|
||||
func (this *AdminClusterTable) PostInit1() {
|
||||
this.selfConf = this.GetById(int64(f5.GetApp().GetInstanceId()))
|
||||
if this.selfConf == nil {
|
||||
panic("imserver集群无法读取本服配置")
|
||||
|
@ -12,7 +12,7 @@ type table struct {
|
||||
}
|
||||
|
||||
var Table = f5.New(func (this* table) {
|
||||
this.IMCluster = f5.New(func (this *IMClusterTable) {
|
||||
this.AdminCluster = f5.New(func (this *AdminClusterTable) {
|
||||
this.FileName = "../config/imserver.cluster.json"
|
||||
this.PrimKey = "instance_id"
|
||||
});
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"f5"
|
||||
)
|
||||
|
||||
type IMCluster struct {
|
||||
type AdminCluster struct {
|
||||
instance_id int32
|
||||
listen_port int32
|
||||
http_listen_port int32
|
||||
@ -51,27 +51,27 @@ type Config struct {
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
func (this *IMCluster) GetInstanceId() int32 {
|
||||
func (this *AdminCluster) GetInstanceId() int32 {
|
||||
return this.instance_id
|
||||
}
|
||||
|
||||
func (this *IMCluster) HasInstanceId() bool {
|
||||
func (this *AdminCluster) HasInstanceId() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *IMCluster) GetListenPort() int32 {
|
||||
func (this *AdminCluster) GetListenPort() int32 {
|
||||
return this.listen_port
|
||||
}
|
||||
|
||||
func (this *IMCluster) HasListenPort() bool {
|
||||
func (this *AdminCluster) HasListenPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *IMCluster) GetHttpListenPort() int32 {
|
||||
func (this *AdminCluster) GetHttpListenPort() int32 {
|
||||
return this.http_listen_port
|
||||
}
|
||||
|
||||
func (this *IMCluster) HasHttpListenPort() bool {
|
||||
func (this *AdminCluster) HasHttpListenPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ func (this *Config) HasGameapiUrl() bool {
|
||||
}
|
||||
|
||||
|
||||
func (this *IMCluster) LoadFromKv(kv map[string]interface{}) {
|
||||
func (this *AdminCluster) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.listen_port, "listen_port", &this._flags1_, 2, kv)
|
||||
f5.ReadMetaTableField(&this.http_listen_port, "http_listen_port", &this._flags1_, 3, kv)
|
||||
|
Loading…
x
Reference in New Issue
Block a user