1
This commit is contained in:
parent
1c9744a74c
commit
f380b15dd8
@ -12,11 +12,11 @@ type app struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *app) GetPkgName() string {
|
func (this *app) GetPkgName() string {
|
||||||
return "gameservice"
|
return "backtask"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *app) GetHttpListenPort() int32 {
|
func (this *app) GetHttpListenPort() int32 {
|
||||||
return mt.Table.GameServiceCluster.GetHttpListenPort()
|
return mt.Table.BackTaskCluster.GetHttpListenPort()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *app) Run(initCb func(), unInitCb func()) {
|
func (this *app) Run(initCb func(), unInitCb func()) {
|
||||||
|
34
server/backtask/mt/BackTaskCluster.go
Normal file
34
server/backtask/mt/BackTaskCluster.go
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package mt
|
||||||
|
|
||||||
|
import (
|
||||||
|
"f5"
|
||||||
|
"mtb"
|
||||||
|
)
|
||||||
|
|
||||||
|
type BackTaskCluster struct {
|
||||||
|
mtb.BackTaskCluster
|
||||||
|
}
|
||||||
|
|
||||||
|
type BackTaskClusterTable struct {
|
||||||
|
f5.IdMetaTable[BackTaskCluster]
|
||||||
|
selfConf *BackTaskCluster
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *BackTaskCluster) Init1() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *BackTaskClusterTable) GetListenPort() int32 {
|
||||||
|
return this.selfConf.GetListenPort()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *BackTaskClusterTable) GetHttpListenPort() int32 {
|
||||||
|
return this.selfConf.GetHttpListenPort()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *BackTaskClusterTable) PostInit1() {
|
||||||
|
this.selfConf = this.GetById(int64(f5.GetApp().GetInstanceId()))
|
||||||
|
if this.selfConf == nil {
|
||||||
|
panic("backtask集群无法读取本服配置")
|
||||||
|
}
|
||||||
|
}
|
@ -1,34 +0,0 @@
|
|||||||
package mt
|
|
||||||
|
|
||||||
import (
|
|
||||||
"f5"
|
|
||||||
"mtb"
|
|
||||||
)
|
|
||||||
|
|
||||||
type GameServiceCluster struct {
|
|
||||||
mtb.GameServiceCluster
|
|
||||||
}
|
|
||||||
|
|
||||||
type GameServiceClusterTable struct {
|
|
||||||
f5.IdMetaTable[GameServiceCluster]
|
|
||||||
selfConf *GameServiceCluster
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *GameServiceCluster) Init1() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *GameServiceClusterTable) GetListenPort() int32 {
|
|
||||||
return this.selfConf.GetListenPort()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *GameServiceClusterTable) GetHttpListenPort() int32 {
|
|
||||||
return this.selfConf.GetHttpListenPort()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *GameServiceClusterTable) PostInit1() {
|
|
||||||
this.selfConf = this.GetById(int64(f5.GetApp().GetInstanceId()))
|
|
||||||
if this.selfConf == nil {
|
|
||||||
panic("gameservice集群无法读取本服配置")
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,7 +5,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type table struct {
|
type table struct {
|
||||||
GameServiceCluster *GameServiceClusterTable
|
BackTaskCluster *BackTaskClusterTable
|
||||||
GameDb *GameDbTable
|
GameDb *GameDbTable
|
||||||
BcEventDb *BcEventDbTable
|
BcEventDb *BcEventDbTable
|
||||||
BcNftDb *BcNftDbTable
|
BcNftDb *BcNftDbTable
|
||||||
@ -15,7 +15,7 @@ type table struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var Table = f5.New(func(this *table) {
|
var Table = f5.New(func(this *table) {
|
||||||
this.GameServiceCluster = f5.New(func(this *GameServiceClusterTable) {
|
this.BackTaskCluster = f5.New(func(this *BackTaskClusterTable) {
|
||||||
this.FileName = "../config/adminserver.cluster.json"
|
this.FileName = "../config/adminserver.cluster.json"
|
||||||
this.PrimKey = "instance_id"
|
this.PrimKey = "instance_id"
|
||||||
})
|
})
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"f5"
|
"f5"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GameServiceCluster struct {
|
type BackTaskCluster struct {
|
||||||
instance_id int32
|
instance_id int32
|
||||||
listen_port int32
|
listen_port int32
|
||||||
http_listen_port int32
|
http_listen_port int32
|
||||||
@ -73,27 +73,27 @@ type HashRateCommon struct {
|
|||||||
_flags2_ uint64
|
_flags2_ uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *GameServiceCluster) GetInstanceId() int32 {
|
func (this *BackTaskCluster) GetInstanceId() int32 {
|
||||||
return this.instance_id
|
return this.instance_id
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *GameServiceCluster) HasInstanceId() bool {
|
func (this *BackTaskCluster) HasInstanceId() bool {
|
||||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *GameServiceCluster) GetListenPort() int32 {
|
func (this *BackTaskCluster) GetListenPort() int32 {
|
||||||
return this.listen_port
|
return this.listen_port
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *GameServiceCluster) HasListenPort() bool {
|
func (this *BackTaskCluster) HasListenPort() bool {
|
||||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *GameServiceCluster) GetHttpListenPort() int32 {
|
func (this *BackTaskCluster) GetHttpListenPort() int32 {
|
||||||
return this.http_listen_port
|
return this.http_listen_port
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *GameServiceCluster) HasHttpListenPort() bool {
|
func (this *BackTaskCluster) HasHttpListenPort() bool {
|
||||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,7 +290,7 @@ func (this *HashRateCommon) HasCecPool() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (this *GameServiceCluster) LoadFromKv(kv map[string]interface{}) {
|
func (this *BackTaskCluster) 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)
|
||||||
|
@ -2,7 +2,7 @@ package mt;
|
|||||||
|
|
||||||
option go_package = ".;mt";
|
option go_package = ".;mt";
|
||||||
|
|
||||||
message GameServiceCluster
|
message BackTaskCluster
|
||||||
{
|
{
|
||||||
optional int32 instance_id = 1;
|
optional int32 instance_id = 1;
|
||||||
optional int32 listen_port = 2;
|
optional int32 listen_port = 2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user