This commit is contained in:
aozhiwei 2020-12-13 15:19:23 +08:00
parent f819ba925e
commit 7c03940082
2 changed files with 31 additions and 0 deletions

View File

@ -29,6 +29,17 @@ func (this *MetaMgr) Init() *MetaMgr {
Idx: MT_SERVER_INFO,
RawMeta: (*mt.ServerInfoMetas)(nil),
WrapMeta: (*MtwServerInfo)(nil)},
f5.MetaClass{
PrimKey: "InstanceId",
FileName: configDir + "mysql.cluster.json",
Idx: MT_MYSQL_CONF,
RawMeta: (*mt.MysqlConfMetas)(nil),
WrapMeta: (*MtwMysqlConf)(nil)},
f5.MetaClass{
FileName: configDir + "gamepay_backend.json",
Idx: MT_GAME_CONF,
RawMeta: (*mt.GameConfMetas)(nil),
WrapMeta: (*MtwGameConf)(nil)},
}
this.MetaMgr.RegisterMetaClasses(metaClasses)
this.Load()
@ -47,3 +58,15 @@ func (this *MetaMgr) GetServer(instance_id int32) *MtwServerInfo {
return nil
}
}
func (this *MetaMgr) GetCurrServer() *MtwServerInfo {
return this.GetServer(int32(f5.App.GetInstanceId()))
}
func (this *MetaMgr) GetMysqlCluster() []*MtwMysqlConf {
return this.GetMetaList(MT_MYSQL_CONF).([]*MtwMysqlConf)
}
func (this *MetaMgr) GetGameConfs() []*MtwGameConf {
return this.GetMetaList(MT_GAME_CONF).([]*MtwGameConf)
}

View File

@ -5,3 +5,11 @@ import "mt"
type MtwServerInfo struct {
*mt.ServerInfo
}
type MtwMysqlConf struct {
*mt.MysqlConf
}
type MtwGameConf struct {
*mt.GameConf
}