mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-03 22:45:13 +08:00
优化rankservice错误返回
This commit is contained in:
@@ -295,9 +295,9 @@ func GetService(serviceName string) service.IService {
|
|||||||
return service.GetService(serviceName)
|
return service.GetService(serviceName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetConfigDir(configDir string) {
|
func SetConfigDir(cfgDir string) {
|
||||||
configDir = configDir
|
configDir = cfgDir
|
||||||
cluster.SetConfigDir(configDir)
|
cluster.SetConfigDir(cfgDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetConfigDir() string {
|
func GetConfigDir() string {
|
||||||
|
|||||||
@@ -356,12 +356,12 @@ func (rs *RankSkip) GetRankNodeDataByRank(rank uint64) (*RankData, uint64) {
|
|||||||
// GetRankKeyPrevToLimit 获取key前count名的数据
|
// GetRankKeyPrevToLimit 获取key前count名的数据
|
||||||
func (rs *RankSkip) GetRankKeyPrevToLimit(findKey, count uint64, result *rpc.RankDataList) error {
|
func (rs *RankSkip) GetRankKeyPrevToLimit(findKey, count uint64, result *rpc.RankDataList) error {
|
||||||
if rs.GetRankLen() <= 0 {
|
if rs.GetRankLen() <= 0 {
|
||||||
return fmt.Errorf("rank[", rs.rankId, "] no data")
|
return fmt.Errorf("rank[%d] no data", rs.rankId)
|
||||||
}
|
}
|
||||||
|
|
||||||
findData, ok := rs.mapRankData[findKey]
|
findData, ok := rs.mapRankData[findKey]
|
||||||
if ok == false {
|
if ok == false {
|
||||||
return fmt.Errorf("rank[", rs.rankId, "] no data")
|
return fmt.Errorf("rank[%d] no data", rs.rankId)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, rankPos := rs.skipList.GetWithPosition(findData)
|
_, rankPos := rs.skipList.GetWithPosition(findData)
|
||||||
@@ -385,12 +385,12 @@ func (rs *RankSkip) GetRankKeyPrevToLimit(findKey, count uint64, result *rpc.Ran
|
|||||||
// GetRankKeyPrevToLimit 获取key前count名的数据
|
// GetRankKeyPrevToLimit 获取key前count名的数据
|
||||||
func (rs *RankSkip) GetRankKeyNextToLimit(findKey, count uint64, result *rpc.RankDataList) error {
|
func (rs *RankSkip) GetRankKeyNextToLimit(findKey, count uint64, result *rpc.RankDataList) error {
|
||||||
if rs.GetRankLen() <= 0 {
|
if rs.GetRankLen() <= 0 {
|
||||||
return fmt.Errorf("rank[", rs.rankId, "] no data")
|
return fmt.Errorf("rank[%d] no data", rs.rankId)
|
||||||
}
|
}
|
||||||
|
|
||||||
findData, ok := rs.mapRankData[findKey]
|
findData, ok := rs.mapRankData[findKey]
|
||||||
if ok == false {
|
if ok == false {
|
||||||
return fmt.Errorf("rank[", rs.rankId, "] no data")
|
return fmt.Errorf("rank[%d] no data", rs.rankId)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, rankPos := rs.skipList.GetWithPosition(findData)
|
_, rankPos := rs.skipList.GetWithPosition(findData)
|
||||||
|
|||||||
Reference in New Issue
Block a user