This commit is contained in:
aozhiwei 2020-11-10 11:34:57 +08:00
parent c4c0b13176
commit fc583312ca
13 changed files with 861 additions and 0 deletions

View File

@ -0,0 +1,27 @@
package main
import (
"f5"
)
type App_ struct {
f5.App_
}
var App = new (App_)
func (this *App_) Init() {
f5.App = &this.App_
f5.App.SetPkgName("rankserver")
this.App_.Init()
G.MetaMgr = new(MetaMgr).Init()
G.HttpServer = new(f5.HttpServer).Init("httpserver", 1000 * 60)
G.HttpServer.Start(G.MetaMgr.GetServer(1).GetListenPort());
}
func (this *App_) UnInit() {
G.HttpServer.UnInit()
G.MetaMgr.UnInit()
this.App_.UnInit()
}

View File

@ -0,0 +1,3 @@
package main
const SESSION_KEY = "f3a6a9a5-217a-4079-ab99-b5d69b8212be"

View File

@ -0,0 +1,12 @@
package main
import (
"f5"
)
type GlobalVar struct {
MetaMgr *MetaMgr
HttpServer *f5.HttpServer
}
var G *GlobalVar = &GlobalVar{}

View File

@ -0,0 +1,24 @@
module rankserver
go 1.11
require q5 v1.0.0
require f5 v1.0.0
require mt v1.0.0
require (
github.com/aliyun/alibaba-cloud-sdk-go v1.61.614
github.com/golang/protobuf v1.4.2
google.golang.org/protobuf v1.23.0
im v1.0.0
)
replace q5 => ../../third_party/q5
replace f5 => ../../third_party/f5
replace im => ../../third_party/f5/im
replace mt => ./mt

View File

@ -0,0 +1,45 @@
github.com/aliyun/alibaba-cloud-sdk-go v1.61.614 h1:FHWBfCJLqPmXTe/rdx1D0Dp0uQkNDcadDTmXEO5YcEE=
github.com/aliyun/alibaba-cloud-sdk-go v1.61.614/go.mod h1:pUKYbK5JQ+1Dfxk80P0qxGqe5dkxDoabbZS7zOcouyA=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/json-iterator/go v1.1.5 h1:gL2yXlmiIo4+t+y32d4WGwOjKGYcGOuyrg46vadswDE=
github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
gopkg.in/ini.v1 v1.42.0 h1:7N3gPTt50s8GuLortA00n8AqRTk75qOP98+mTPpgzRk=
gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=

View File

@ -0,0 +1,7 @@
package main
func main() {
App.Init()
App.Run()
App.UnInit()
}

View File

@ -0,0 +1,19 @@
compile:
@. /etc/profile
protoc --proto_path=proto --go_out=./mt proto/mt.proto
@export GOPROXY=https://goproxy.io
@go build -gcflags=all="-N -l" -o ../bin/gamepay_backend
@echo "compile done"
debug:
@. /etc/profile
protoc --proto_path=proto --go_out=./mt proto/mt.proto
@export GOPROXY=https://goproxy.io
@go build -gcflags=all="-N -l" -ldflags "-X q5.optDebug=1" -o ../bin/gamepay_backend
@echo "compile done"
clean:
@rm -f ../bin/gamepay_backend
@echo "clean done"

View File

@ -0,0 +1,58 @@
package main
import (
"f5"
"mt"
)
const (
MT_SERVER_INFO = iota
MT_RANK_CONFIG
MT_MAX
)
type MetaMgr struct {
f5.MetaMgr
}
func (this *MetaMgr) Init() *MetaMgr {
this.MetaMgr.Init()
configDir := "../config/"
if !f5.IsOnlineEnv() {
configDir = "/var/data/conf_test/rankserver/"
}
metaClasses := &[]f5.MetaClass{
f5.MetaClass{
PrimKey: "InstanceId",
FileName: configDir + "rankserver.cluster.json",
Idx: MT_SERVER_INFO,
RawMeta: (*mt.ServerInfoMetas)(nil),
WrapMeta: (*MtwServerInfo)(nil)},
f5.MetaClass{
PrimKey: "Name",
FileName: configDir + "rank_config.json",
Idx: MT_RANK_CONFIG,
RawMeta: (*mt.RankConfig)(nil),
WrapMeta: (*MtwRankConfig)(nil)},
}
this.MetaMgr.RegisterMetaClasses(metaClasses)
this.Load()
return this
}
func (this *MetaMgr) UnInit() {
this.MetaMgr.UnInit()
}
func (this *MetaMgr) GetServer(instance_id int32) *MtwServerInfo {
v, ok := this.MetaMgr.GetMetaById(MT_SERVER_INFO, instance_id).(*MtwServerInfo)
if ok {
return v
} else {
return nil
}
}
func (this *MetaMgr) GetRankConfig() []*MtwRankConfig {
return this.MetaMgr.GetMetaList(MT_RANK_CONFIG).([]*MtwRankConfig)
}

View File

@ -0,0 +1,15 @@
package main
import "mt"
type MtwServerInfo struct {
*mt.ServerInfo
}
type MtwRankConfig struct {
*mt.RankConfig
}
func (this* MtwRankConfig) Init() {
}

View File

@ -0,0 +1,8 @@
module metatable
go 1.15
require (
github.com/golang/protobuf v1.4.2
google.golang.org/protobuf v1.23.0
)

View File

@ -0,0 +1,19 @@
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=

View File

@ -0,0 +1,578 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.23.0
// protoc (unknown)
// source: mt.proto
package mt
import (
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type ServerInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
InstanceId *int32 `protobuf:"varint,1,opt,name=instance_id,json=instanceId" json:"instance_id,omitempty"`
ListenIp *string `protobuf:"bytes,2,opt,name=listen_ip,json=listenIp" json:"listen_ip,omitempty"`
ListenPort *int32 `protobuf:"varint,3,opt,name=listen_port,json=listenPort" json:"listen_port,omitempty"`
}
func (x *ServerInfo) Reset() {
*x = ServerInfo{}
if protoimpl.UnsafeEnabled {
mi := &file_mt_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ServerInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ServerInfo) ProtoMessage() {}
func (x *ServerInfo) ProtoReflect() protoreflect.Message {
mi := &file_mt_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ServerInfo.ProtoReflect.Descriptor instead.
func (*ServerInfo) Descriptor() ([]byte, []int) {
return file_mt_proto_rawDescGZIP(), []int{0}
}
func (x *ServerInfo) GetInstanceId() int32 {
if x != nil && x.InstanceId != nil {
return *x.InstanceId
}
return 0
}
func (x *ServerInfo) GetListenIp() string {
if x != nil && x.ListenIp != nil {
return *x.ListenIp
}
return ""
}
func (x *ServerInfo) GetListenPort() int32 {
if x != nil && x.ListenPort != nil {
return *x.ListenPort
}
return 0
}
type ServerInfoMetas struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Values []*ServerInfo `protobuf:"bytes,1,rep,name=values" json:"values,omitempty"`
}
func (x *ServerInfoMetas) Reset() {
*x = ServerInfoMetas{}
if protoimpl.UnsafeEnabled {
mi := &file_mt_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ServerInfoMetas) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ServerInfoMetas) ProtoMessage() {}
func (x *ServerInfoMetas) ProtoReflect() protoreflect.Message {
mi := &file_mt_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ServerInfoMetas.ProtoReflect.Descriptor instead.
func (*ServerInfoMetas) Descriptor() ([]byte, []int) {
return file_mt_proto_rawDescGZIP(), []int{1}
}
func (x *ServerInfoMetas) GetValues() []*ServerInfo {
if x != nil {
return x.Values
}
return nil
}
type RedisConfig struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Host *string `protobuf:"bytes,1,opt,name=host" json:"host,omitempty"`
Port *int32 `protobuf:"varint,2,opt,name=port" json:"port,omitempty"`
Passwd *string `protobuf:"bytes,3,opt,name=passwd" json:"passwd,omitempty"`
}
func (x *RedisConfig) Reset() {
*x = RedisConfig{}
if protoimpl.UnsafeEnabled {
mi := &file_mt_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RedisConfig) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RedisConfig) ProtoMessage() {}
func (x *RedisConfig) ProtoReflect() protoreflect.Message {
mi := &file_mt_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RedisConfig.ProtoReflect.Descriptor instead.
func (*RedisConfig) Descriptor() ([]byte, []int) {
return file_mt_proto_rawDescGZIP(), []int{2}
}
func (x *RedisConfig) GetHost() string {
if x != nil && x.Host != nil {
return *x.Host
}
return ""
}
func (x *RedisConfig) GetPort() int32 {
if x != nil && x.Port != nil {
return *x.Port
}
return 0
}
func (x *RedisConfig) GetPasswd() string {
if x != nil && x.Passwd != nil {
return *x.Passwd
}
return ""
}
type MysqlConfig struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
InstanceId *int32 `protobuf:"varint,1,opt,name=instance_id,json=instanceId" json:"instance_id,omitempty"`
Host *string `protobuf:"bytes,2,opt,name=host" json:"host,omitempty"`
Port *int32 `protobuf:"varint,3,opt,name=port" json:"port,omitempty"`
User *string `protobuf:"bytes,4,opt,name=user" json:"user,omitempty"`
Passwd *string `protobuf:"bytes,5,opt,name=passwd" json:"passwd,omitempty"`
}
func (x *MysqlConfig) Reset() {
*x = MysqlConfig{}
if protoimpl.UnsafeEnabled {
mi := &file_mt_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MysqlConfig) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MysqlConfig) ProtoMessage() {}
func (x *MysqlConfig) ProtoReflect() protoreflect.Message {
mi := &file_mt_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MysqlConfig.ProtoReflect.Descriptor instead.
func (*MysqlConfig) Descriptor() ([]byte, []int) {
return file_mt_proto_rawDescGZIP(), []int{3}
}
func (x *MysqlConfig) GetInstanceId() int32 {
if x != nil && x.InstanceId != nil {
return *x.InstanceId
}
return 0
}
func (x *MysqlConfig) GetHost() string {
if x != nil && x.Host != nil {
return *x.Host
}
return ""
}
func (x *MysqlConfig) GetPort() int32 {
if x != nil && x.Port != nil {
return *x.Port
}
return 0
}
func (x *MysqlConfig) GetUser() string {
if x != nil && x.User != nil {
return *x.User
}
return ""
}
func (x *MysqlConfig) GetPasswd() string {
if x != nil && x.Passwd != nil {
return *x.Passwd
}
return ""
}
type RankConfig struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
OnlyChannels []string `protobuf:"bytes,1,rep,name=only_channels,json=onlyChannels" json:"only_channels,omitempty"`
ExcludeChannels []string `protobuf:"bytes,2,rep,name=exclude_channels,json=excludeChannels" json:"exclude_channels,omitempty"`
ConfigDir *string `protobuf:"bytes,3,opt,name=config_dir,json=configDir" json:"config_dir,omitempty"`
Name *string `protobuf:"bytes,4,opt,name=name" json:"name,omitempty"`
DbnamePrefix *string `protobuf:"bytes,5,opt,name=dbname_prefix,json=dbnamePrefix" json:"dbname_prefix,omitempty"`
Rule *string `protobuf:"bytes,6,opt,name=rule" json:"rule,omitempty"`
}
func (x *RankConfig) Reset() {
*x = RankConfig{}
if protoimpl.UnsafeEnabled {
mi := &file_mt_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RankConfig) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RankConfig) ProtoMessage() {}
func (x *RankConfig) ProtoReflect() protoreflect.Message {
mi := &file_mt_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RankConfig.ProtoReflect.Descriptor instead.
func (*RankConfig) Descriptor() ([]byte, []int) {
return file_mt_proto_rawDescGZIP(), []int{4}
}
func (x *RankConfig) GetOnlyChannels() []string {
if x != nil {
return x.OnlyChannels
}
return nil
}
func (x *RankConfig) GetExcludeChannels() []string {
if x != nil {
return x.ExcludeChannels
}
return nil
}
func (x *RankConfig) GetConfigDir() string {
if x != nil && x.ConfigDir != nil {
return *x.ConfigDir
}
return ""
}
func (x *RankConfig) GetName() string {
if x != nil && x.Name != nil {
return *x.Name
}
return ""
}
func (x *RankConfig) GetDbnamePrefix() string {
if x != nil && x.DbnamePrefix != nil {
return *x.DbnamePrefix
}
return ""
}
func (x *RankConfig) GetRule() string {
if x != nil && x.Rule != nil {
return *x.Rule
}
return ""
}
type RankConfigMetas struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Values []*RankConfig `protobuf:"bytes,1,rep,name=values" json:"values,omitempty"`
}
func (x *RankConfigMetas) Reset() {
*x = RankConfigMetas{}
if protoimpl.UnsafeEnabled {
mi := &file_mt_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RankConfigMetas) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RankConfigMetas) ProtoMessage() {}
func (x *RankConfigMetas) ProtoReflect() protoreflect.Message {
mi := &file_mt_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RankConfigMetas.ProtoReflect.Descriptor instead.
func (*RankConfigMetas) Descriptor() ([]byte, []int) {
return file_mt_proto_rawDescGZIP(), []int{5}
}
func (x *RankConfigMetas) GetValues() []*RankConfig {
if x != nil {
return x.Values
}
return nil
}
var File_mt_proto protoreflect.FileDescriptor
var file_mt_proto_rawDesc = []byte{
0x0a, 0x08, 0x6d, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x6d, 0x74, 0x22, 0x49,
0x0a, 0x0a, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x13, 0x0a, 0x0b,
0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x05, 0x12, 0x11, 0x0a, 0x09, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x5f, 0x69, 0x70, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x12, 0x13, 0x0a, 0x0b, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x5f, 0x70,
0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x22, 0x31, 0x0a, 0x0f, 0x53, 0x65, 0x72,
0x76, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x4d, 0x65, 0x74, 0x61, 0x73, 0x12, 0x1e, 0x0a, 0x06,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d,
0x74, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x39, 0x0a, 0x0b,
0x52, 0x65, 0x64, 0x69, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x0c, 0x0a, 0x04, 0x68,
0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x12, 0x0c, 0x0a, 0x04, 0x70, 0x6f, 0x72,
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x12, 0x0e, 0x0a, 0x06, 0x70, 0x61, 0x73, 0x73, 0x77,
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x22, 0x5c, 0x0a, 0x0b, 0x4d, 0x79, 0x73, 0x71, 0x6c,
0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x13, 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e,
0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x12, 0x0c, 0x0a, 0x04, 0x68,
0x6f, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x12, 0x0c, 0x0a, 0x04, 0x70, 0x6f, 0x72,
0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x12, 0x0c, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18,
0x04, 0x20, 0x01, 0x28, 0x09, 0x12, 0x0e, 0x0a, 0x06, 0x70, 0x61, 0x73, 0x73, 0x77, 0x64, 0x18,
0x05, 0x20, 0x01, 0x28, 0x09, 0x22, 0x84, 0x01, 0x0a, 0x0a, 0x52, 0x61, 0x6e, 0x6b, 0x43, 0x6f,
0x6e, 0x66, 0x69, 0x67, 0x12, 0x15, 0x0a, 0x0d, 0x6f, 0x6e, 0x6c, 0x79, 0x5f, 0x63, 0x68, 0x61,
0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x12, 0x18, 0x0a, 0x10, 0x65,
0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x18,
0x02, 0x20, 0x03, 0x28, 0x09, 0x12, 0x12, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f,
0x64, 0x69, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x12, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x12, 0x15, 0x0a, 0x0d, 0x64, 0x62, 0x6e, 0x61, 0x6d,
0x65, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x12, 0x0c,
0x0a, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x22, 0x31, 0x0a, 0x0f,
0x52, 0x61, 0x6e, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4d, 0x65, 0x74, 0x61, 0x73, 0x12,
0x1e, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x0e, 0x2e, 0x6d, 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42,
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x6d, 0x74,
}
var (
file_mt_proto_rawDescOnce sync.Once
file_mt_proto_rawDescData = file_mt_proto_rawDesc
)
func file_mt_proto_rawDescGZIP() []byte {
file_mt_proto_rawDescOnce.Do(func() {
file_mt_proto_rawDescData = protoimpl.X.CompressGZIP(file_mt_proto_rawDescData)
})
return file_mt_proto_rawDescData
}
var file_mt_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_mt_proto_goTypes = []interface{}{
(*ServerInfo)(nil), // 0: mt.ServerInfo
(*ServerInfoMetas)(nil), // 1: mt.ServerInfoMetas
(*RedisConfig)(nil), // 2: mt.RedisConfig
(*MysqlConfig)(nil), // 3: mt.MysqlConfig
(*RankConfig)(nil), // 4: mt.RankConfig
(*RankConfigMetas)(nil), // 5: mt.RankConfigMetas
}
var file_mt_proto_depIdxs = []int32{
0, // 0: mt.ServerInfoMetas.values:type_name -> mt.ServerInfo
4, // 1: mt.RankConfigMetas.values:type_name -> mt.RankConfig
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_mt_proto_init() }
func file_mt_proto_init() {
if File_mt_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_mt_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerInfo); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mt_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerInfoMetas); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mt_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RedisConfig); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mt_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MysqlConfig); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mt_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RankConfig); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mt_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RankConfigMetas); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_mt_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_mt_proto_goTypes,
DependencyIndexes: file_mt_proto_depIdxs,
MessageInfos: file_mt_proto_msgTypes,
}.Build()
File_mt_proto = out.File
file_mt_proto_rawDesc = nil
file_mt_proto_goTypes = nil
file_mt_proto_depIdxs = nil
}

View File

@ -0,0 +1,46 @@
package mt;
option go_package = ".;mt";
message ServerInfo
{
optional int32 instance_id = 1;
optional string listen_ip = 2;
optional int32 listen_port = 3;
}
message ServerInfoMetas
{
repeated ServerInfo values = 1;
}
message RedisConfig
{
optional string host = 1;
optional int32 port = 2;
optional string passwd = 3;
}
message MysqlConfig
{
optional int32 instance_id = 1;
optional string host = 2;
optional int32 port = 3;
optional string user = 4;
optional string passwd = 5;
}
message RankConfig
{
repeated string only_channels = 1;
repeated string exclude_channels = 2;
optional string config_dir = 3;
optional string name = 4;
optional string dbname_prefix = 5;
optional string rule = 6;
}
message RankConfigMetas
{
repeated RankConfig values = 1;
}