Documentation ¶
Index ¶
- Constants
- Variables
- func Load(infos []*DbRankInfo)
- func LoadRankTrees(infos []*DbRankInfo) map[int16]*RankTree
- func ResetRankTree(rtype int16, rank *RankTree)
- func SaveRanking(rt *RankTree, filename string) error
- type DbRankInfo
- type RankInfo
- type RankTree
- func (rt *RankTree) AddRankInfo(uid int64, val int64, timestamp int64)
- func (rt *RankTree) IncrRankInfo(uid int64, val int64, timestamp int64)
- func (rt *RankTree) QueryByRank(rank int32) *RankInfo
- func (rt *RankTree) QueryByRankRange(min, max int32) []*RankInfo
- func (rt *RankTree) QueryRankInfo(uid int64) *RankInfo
- func (rt *RankTree) RemoveRankInfo(uid int64) bool
Constants ¶
View Source
const ( // 跳跃表最大层数 SKIPLIST_MAXLEVEL = 32 // 随机概率 SKIPLIST_P = 0.25 )
Variables ¶
View Source
var (
RTS = make(map[int16]*RankTree)
)
Functions ¶
func Load ¶
func Load(infos []*DbRankInfo)
func LoadRankTrees ¶
func LoadRankTrees(infos []*DbRankInfo) map[int16]*RankTree
LoadRankTrees 从dump加载排名模块
func ResetRankTree ¶
Types ¶
type DbRankInfo ¶
func Save ¶
func Save() []*DbRankInfo
func SaveRankTrees ¶
func SaveRankTrees(rts map[int16]*RankTree) []*DbRankInfo
SaveRankTrees dump排名模块
type RankTree ¶
func GetRankTree ¶
func NewRankTree ¶
func NewRankTree() *RankTree
func (*RankTree) AddRankInfo ¶
AddRankInfo 添加新排名信息
func (*RankTree) IncrRankInfo ¶
IncrRankInfo 更新排名信息
func (*RankTree) QueryByRank ¶
QueryByRank 根据排名查询信息
func (*RankTree) QueryByRankRange ¶
QueryByRankRange 查询指定范围排名
func (*RankTree) QueryRankInfo ¶
QueryRankInfo 查询用户排名
func (*RankTree) RemoveRankInfo ¶
RemoveRankInfo 删除排名信息
Click to show internal directories.
Click to hide internal directories.