diff --git a/rpc/rank.pb.go b/rpc/rank.pb.go index f92a709..ff8cdfc 100644 --- a/rpc/rank.pb.go +++ b/rpc/rank.pb.go @@ -161,10 +161,11 @@ func (m *RankPosData) GetData() []byte { // RankList 排行榜数据 type RankList struct { RankId uint64 `protobuf:"varint,1,opt,name=RankId,proto3" json:"RankId,omitempty"` - SkipListLevel int32 `protobuf:"varint,2,opt,name=SkipListLevel,proto3" json:"SkipListLevel,omitempty"` - IsDec bool `protobuf:"varint,3,opt,name=IsDec,proto3" json:"IsDec,omitempty"` - MaxRank uint64 `protobuf:"varint,4,opt,name=MaxRank,proto3" json:"MaxRank,omitempty"` - ExpireMs int64 `protobuf:"varint,5,opt,name=ExpireMs,proto3" json:"ExpireMs,omitempty"` + RankName string `protobuf:"bytes,2,opt,name=RankName,proto3" json:"RankName,omitempty"` + SkipListLevel int32 `protobuf:"varint,3,opt,name=SkipListLevel,proto3" json:"SkipListLevel,omitempty"` + IsDec bool `protobuf:"varint,4,opt,name=IsDec,proto3" json:"IsDec,omitempty"` + MaxRank uint64 `protobuf:"varint,5,opt,name=MaxRank,proto3" json:"MaxRank,omitempty"` + ExpireMs int64 `protobuf:"varint,6,opt,name=ExpireMs,proto3" json:"ExpireMs,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -210,6 +211,13 @@ func (m *RankList) GetRankId() uint64 { return 0 } +func (m *RankList) GetRankName() string { + if m != nil { + return m.RankName + } + return "" +} + func (m *RankList) GetSkipListLevel() int32 { if m != nil { return m.SkipListLevel @@ -727,38 +735,39 @@ func init() { func init() { proto.RegisterFile("proto/rpcproto/rank.proto", fileDescriptor_d5b64eda47521620) } var fileDescriptor_d5b64eda47521620 = []byte{ - // 489 bytes of a gzipped FileDescriptorProto + // 502 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54,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x45, + 0xb9, 0x43, 0xe5, 0x7a, 0x0a, 0x3b, 0x84, 0xbc, 0x48, 0xaf, 0xe4, 0x7e, 0x30, 0x8e, 0xa8, 0xa7, + 0x4e, 0x1e, 0xfc, 0xdd, 0x8d, 0xd8, 0xbf, 0xdd, 0x88, 0xfd, 0xdf, 0x8d, 0xd8, 0xb9, 0x33, 0x79, + 0x9f, 0xa9, 0xe8, 0x67, 0x97, 0xbe, 0x2d, 0x6f, 0x6e, 0x02, 0x00, 0x00, 0xff, 0xff, 0x95, 0xfb, + 0xbc, 0xc4, 0x78, 0x04, 0x00, 0x00, } func (m *RankData) Marshal() (dAtA []byte, err error) { @@ -909,12 +918,12 @@ func (m *RankList) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.ExpireMs != 0 { i = encodeVarintRank(dAtA, i, uint64(m.ExpireMs)) i-- - dAtA[i] = 0x28 + dAtA[i] = 0x30 } if m.MaxRank != 0 { i = encodeVarintRank(dAtA, i, uint64(m.MaxRank)) i-- - dAtA[i] = 0x20 + dAtA[i] = 0x28 } if m.IsDec { i-- @@ -924,12 +933,19 @@ func (m *RankList) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0 } i-- - dAtA[i] = 0x18 + dAtA[i] = 0x20 } if m.SkipListLevel != 0 { i = encodeVarintRank(dAtA, i, uint64(m.SkipListLevel)) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x18 + } + if len(m.RankName) > 0 { + i -= len(m.RankName) + copy(dAtA[i:], m.RankName) + i = encodeVarintRank(dAtA, i, uint64(len(m.RankName))) + i-- + dAtA[i] = 0x12 } if m.RankId != 0 { i = encodeVarintRank(dAtA, i, uint64(m.RankId)) @@ -1372,6 +1388,10 @@ func (m *RankList) Size() (n int) { if m.RankId != 0 { n += 1 + sovRank(uint64(m.RankId)) } + l = len(m.RankName) + if l > 0 { + n += 1 + l + sovRank(uint64(l)) + } if m.SkipListLevel != 0 { n += 1 + sovRank(uint64(m.SkipListLevel)) } @@ -1997,6 +2017,38 @@ func (m *RankList) Unmarshal(dAtA []byte) error { } } case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RankName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRank + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRank + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RankName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field SkipListLevel", wireType) } @@ -2015,7 +2067,7 @@ func (m *RankList) Unmarshal(dAtA []byte) error { break } } - case 3: + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field IsDec", wireType) } @@ -2035,7 +2087,7 @@ func (m *RankList) Unmarshal(dAtA []byte) error { } } m.IsDec = bool(v != 0) - case 4: + case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MaxRank", wireType) } @@ -2054,7 +2106,7 @@ func (m *RankList) Unmarshal(dAtA []byte) error { break } } - case 5: + case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ExpireMs", wireType) } diff --git a/rpc/rank.proto b/rpc/rank.proto index ab013f5..ee82c28 100644 --- a/rpc/rank.proto +++ b/rpc/rank.proto @@ -20,10 +20,11 @@ message RankPosData { // RankList 排行榜数据 message RankList { uint64 RankId = 1; //排行榜类型 - int32 SkipListLevel = 2; //排行榜level-生成的跳表的level, 8/16/32/64等 - bool IsDec = 3; //不参与排行的数据 - uint64 MaxRank = 4; //最大排名 - int64 ExpireMs = 5;//有效时间毫秒,0表示永不过期 + string RankName = 2; //排行榜名称 + int32 SkipListLevel = 3; //排行榜level-生成的跳表的level, 8/16/32/64等 + bool IsDec = 4; //不参与排行的数据 + uint64 MaxRank = 5; //最大排名 + int64 ExpireMs = 6; //有效时间,0永不过期 } // UpsetRankData 更新排行榜数据 @@ -60,12 +61,14 @@ message FindRankDataList { uint64 RankId = 1; //排行榜的ID uint64 StartRank = 2; //排行的位置 0开始 uint64 Count = 3; //查询格式 + uint64 Key = 4; //附带一个Key查询排行信息 } // RankDataList message RankDataList { uint64 RankDataCount = 1; //排行长度 repeated RankPosData RankPosDataList = 2; //排行数据 + RankPosData KeyRank = 3; //附带的Key查询排行结果信息 } // RankResult diff --git a/sysservice/rankservice/MongodbPersist.go b/sysservice/rankservice/MongodbPersist.go index 2f549bd..5db5cb4 100644 --- a/sysservice/rankservice/MongodbPersist.go +++ b/sysservice/rankservice/MongodbPersist.go @@ -129,20 +129,23 @@ func (mp *MongoPersist) ReadCfg() error { func (mp *MongoPersist) OnStart() { } -func (mp *MongoPersist) OnFinishSetupRank(mapRankSkip map[uint64]*RankSkip) error{ - mp.mapRankSkip = map[uint64]IRankSkip{} - for rankId,rank := range mapRankSkip { - mp.mapRankSkip[rankId] = rank +func (mp *MongoPersist) OnSetupRank(manual bool,rankSkip *RankSkip) error{ + if mp.mapRankSkip == nil { + mp.mapRankSkip = map[uint64]IRankSkip{} } - for rankId,rank := range mp.mapRankSkip{ - err := mp.loadFromDB(rankId,rank.GetRankName()) - if err != nil { - log.SError("load from db is fail :%s",err.Error()) - return err - } + mp.mapRankSkip[rankSkip.GetRankID()] = rankSkip + if manual == true { + return nil } + log.SRelease("start load rank ",rankSkip.GetRankName()," from mongodb.") + err := mp.loadFromDB(rankSkip.GetRankID(),rankSkip.GetRankName()) + if err != nil { + log.SError("load from db is fail :%s",err.Error()) + return err + } + log.SRelease("finish load rank ",rankSkip.GetRankName()," from mongodb.") return nil } diff --git a/sysservice/rankservice/RankInterface.go b/sysservice/rankservice/RankInterface.go index 634d0c5..15af6be 100644 --- a/sysservice/rankservice/RankInterface.go +++ b/sysservice/rankservice/RankInterface.go @@ -17,7 +17,8 @@ type IRankSkip interface { type IRankModule interface { service.IModule - OnFinishSetupRank(map[uint64]*RankSkip) error //当完成安装排行榜对象时 + + OnSetupRank(manual bool,rankSkip *RankSkip) error //当完成安装排行榜对象时 OnStart() //服务开启时回调 OnEnterRank(rankSkip IRankSkip, enterData *RankData) //进入排行 OnLeaveRank(rankSkip IRankSkip, leaveData *RankData) //离开排行 diff --git a/sysservice/rankservice/RankService.go b/sysservice/rankservice/RankService.go index 25b383c..0b0ea2c 100644 --- a/sysservice/rankservice/RankService.go +++ b/sysservice/rankservice/RankService.go @@ -48,6 +48,30 @@ func (rs *RankService) SetupRankModule(rankModule IRankModule) { rs.rankModule = rankModule } +// RPC_ManualAddRankSkip 提供手动添加排行榜 +func (rs *RankService) RPC_ManualAddRankSkip(addInfo *rpc.AddRankList, addResult *rpc.RankResult) error { + for _, addRankListData := range addInfo.AddList { + if addRankListData.RankId == 0 { + return fmt.Errorf("RPC_AddRankSkip must has rank id") + } + + //重复的排行榜信息不允许添加 + rank := rs.mapRankSkip[addRankListData.RankId] + if rank != nil { + continue + } + + newSkip := NewRankSkip(addRankListData.RankId,addRankListData.RankName,addRankListData.IsDec, transformLevel(addRankListData.SkipListLevel), addRankListData.MaxRank,time.Duration(addRankListData.ExpireMs)*time.Millisecond) + newSkip.SetupRankModule(rs.rankModule) + + rs.mapRankSkip[addRankListData.RankId] = newSkip + rs.rankModule.OnSetupRank(true,newSkip) + } + + addResult.AddCount = 1 + return nil +} + // RPC_UpsetRank 更新排行榜 func (rs *RankService) RPC_UpsetRank(upsetInfo *rpc.UpsetRankData, upsetResult *rpc.RankResult) error { rankSkip, ok := rs.mapRankSkip[upsetInfo.RankId] @@ -187,9 +211,13 @@ func (rs *RankService) dealCfg() error { newSkip := NewRankSkip(uint64(rankId),rankName,isDec, transformLevel(int32(level)), uint64(maxRank),time.Duration(expireMs)*time.Millisecond) newSkip.SetupRankModule(rs.rankModule) rs.mapRankSkip[uint64(rankId)] = newSkip + err := rs.rankModule.OnSetupRank(false,newSkip) + if err != nil { + return err + } } - return rs.rankModule.OnFinishSetupRank(rs.mapRankSkip) + return nil } diff --git a/sysservice/rankservice/rank.proto b/sysservice/rankservice/rank.proto deleted file mode 100644 index 91d3e81..0000000 --- a/sysservice/rankservice/rank.proto +++ /dev/null @@ -1,76 +0,0 @@ -syntax = "proto3"; -package rpc; -option go_package = ".;rpc"; - -// RankData 排行数据 -message RankData { - uint64 Key = 1; //数据主建 - repeated int64 SortData = 2; //参与排行的数据 - bytes Data = 3; //不参与排行的数据 - int64 expireMs = 4; //剩余有效时间毫秒,如果为0永不过期 -} - -// RankPosData 排行数据——查询返回 -message RankPosData { - uint64 Key = 1; //数据主建 - uint64 RankPos = 2; //名次 - repeated int64 SortData = 3; //参与排行的数据 - bytes Data = 4; //不参与排行的数据 -} - -// RankList 排行榜数据 -message RankList { - uint64 RankId = 1; //排行榜类型 - int32 SkipListLevel = 2; //排行榜level-生成的跳表的level, 8/16/32/64等 - bool IsDec = 3; //不参与排行的数据 - uint64 MaxRank = 4; //最大排名 -} - -// UpsetRankData 更新排行榜数据 -message UpsetRankData { - uint64 RankId = 1; //排行榜的ID - repeated RankData RankDataList = 2; //排行数据 -} - -// DeleteByKey 更新排行榜数据 -message DeleteByKey { - uint64 RankId = 1; //排行榜的分类ID - repeated uint64 KeyList = 2; //排行数据 -} - -// AddRankList 新增排行榜 -message AddRankList { - repeated RankList AddList = 1; //添加的排行榜列表 -} - -// FindRankDataByKey 查找排行信息 -message FindRankDataByKey { - uint64 RankId = 1; //排行榜的ID - uint64 Key = 2; //排行的key -} - -// FindRankDataByPos 查找排行信息 -message FindRankDataByPos { - uint64 RankId = 1; //排行榜的ID - uint64 Pos = 2; //排行名次 -} - -// FindRankDataListStartTo 查找排行信息,StartPos开始Count个 -message FindRankDataListStartTo { - uint64 RankId = 1; //排行榜的ID - uint64 StartPos = 2; //排行的位置 0开始 - uint64 Count = 3; //查询格式 -} - -// RankDataList -message RankDataList { - uint64 RankDataCount = 1; //排行长度 - repeated RankPosData RankPosDataList = 2; //排行数据 -} - -// RankResult -message RankResult { - int32 AddCount = 1; //增加记录 - int32 RemoveCount = 2; //删除数量 - int32 ModifyCount = 3; //修改数量 -}