This commit is contained in:
aozhiwei 2023-09-04 18:37:59 +08:00
parent e4b1bd4038
commit 3de0068376
4 changed files with 18 additions and 21 deletions

View File

@ -1,11 +1,8 @@
package main package main
import ( import (
"cs"
"f5" "f5"
"mt" "mt"
"q5"
"ss"
) )
type App struct { type App struct {

View File

@ -5,28 +5,28 @@ import (
"mtb" "mtb"
) )
type IMCluster struct { type AdminCluster struct {
mtb.IMCluster mtb.AdminCluster
} }
type IMClusterTable struct { type AdminClusterTable struct {
f5.IdMetaTable[IMCluster] f5.IdMetaTable[AdminCluster]
selfConf *IMCluster selfConf *AdminCluster
} }
func (this *IMCluster) Init1() { func (this *AdminCluster) Init1() {
} }
func (this *IMClusterTable) GetListenPort() int32 { func (this *AdminClusterTable) GetListenPort() int32 {
return this.selfConf.GetListenPort() return this.selfConf.GetListenPort()
} }
func (this *IMClusterTable) GetHttpListenPort() int32 { func (this *AdminClusterTable) GetHttpListenPort() int32 {
return this.selfConf.GetHttpListenPort() return this.selfConf.GetHttpListenPort()
} }
func (this *IMClusterTable) PostInit1() { func (this *AdminClusterTable) PostInit1() {
this.selfConf = this.GetById(int64(f5.GetApp().GetInstanceId())) this.selfConf = this.GetById(int64(f5.GetApp().GetInstanceId()))
if this.selfConf == nil { if this.selfConf == nil {
panic("imserver集群无法读取本服配置") panic("imserver集群无法读取本服配置")

View File

@ -12,7 +12,7 @@ type table struct {
} }
var Table = f5.New(func (this* table) { 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.FileName = "../config/imserver.cluster.json"
this.PrimKey = "instance_id" this.PrimKey = "instance_id"
}); });

View File

@ -4,7 +4,7 @@ import (
"f5" "f5"
) )
type IMCluster struct { type AdminCluster struct {
instance_id int32 instance_id int32
listen_port int32 listen_port int32
http_listen_port int32 http_listen_port int32
@ -51,27 +51,27 @@ type Config struct {
_flags2_ uint64 _flags2_ uint64
} }
func (this *IMCluster) GetInstanceId() int32 { func (this *AdminCluster) GetInstanceId() int32 {
return this.instance_id return this.instance_id
} }
func (this *IMCluster) HasInstanceId() bool { func (this *AdminCluster) HasInstanceId() bool {
return (this._flags1_ & (uint64(1) << 1)) > 0 return (this._flags1_ & (uint64(1) << 1)) > 0
} }
func (this *IMCluster) GetListenPort() int32 { func (this *AdminCluster) GetListenPort() int32 {
return this.listen_port return this.listen_port
} }
func (this *IMCluster) HasListenPort() bool { func (this *AdminCluster) HasListenPort() bool {
return (this._flags1_ & (uint64(1) << 2)) > 0 return (this._flags1_ & (uint64(1) << 2)) > 0
} }
func (this *IMCluster) GetHttpListenPort() int32 { func (this *AdminCluster) GetHttpListenPort() int32 {
return this.http_listen_port return this.http_listen_port
} }
func (this *IMCluster) HasHttpListenPort() bool { func (this *AdminCluster) HasHttpListenPort() bool {
return (this._flags1_ & (uint64(1) << 3)) > 0 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.instance_id, "instance_id", &this._flags1_, 1, kv)
f5.ReadMetaTableField(&this.listen_port, "listen_port", &this._flags1_, 2, 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) f5.ReadMetaTableField(&this.http_listen_port, "http_listen_port", &this._flags1_, 3, kv)