MCPcopy Create free account
hub / github.com/nutsdb/nutsdb / ZRank

Method ZRank

sorted_set.go:216–229  ·  view source on GitHub ↗
(key string, value []byte)

Source from the content-addressed store, hash-verified

214}
215
216func (z *SortedSet) ZRank(key string, value []byte) (int, error) {
217 if sortedSet, ok := z.M[key]; ok {
218 hash, err := utils.GetFnv32(value)
219 if err != nil {
220 return 0, err
221 }
222 rank := sortedSet.FindRank(hash)
223 if rank == 0 {
224 return 0, ErrSortedSetMemberNotExist
225 }
226 return rank, nil
227 }
228 return 0, ErrSortedSetNotFound
229}
230
231func (z *SortedSet) ZRevRank(key string, value []byte) (int, error) {
232 if sortedSet, ok := z.M[key]; ok {

Callers

nothing calls this directly

Calls 2

GetFnv32Function · 0.92
FindRankMethod · 0.80

Tested by

no test coverage detected