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

Method GetByRank

sorted_set.go:759–765  ·  view source on GitHub ↗

GetByRank returns the node at given rank. Note that the rank is 1-based integer. Rank 1 means the first node; Rank -1 means the last node. If remove is true, the returned nodes are removed If node is not found at specific rank, nil is returned. Time complexity of this method is : O(log(N)).

(rank int, remove bool)

Source from the content-addressed store, hash-verified

757//
758// Time complexity of this method is : O(log(N)).
759func (sl *SkipList) GetByRank(rank int, remove bool) *SkipListNode {
760 nodes := sl.GetByRankRange(rank, rank, remove)
761 if len(nodes) == 1 {
762 return nodes[0]
763 }
764 return nil
765}
766
767// GetByValue returns the node at given key.
768// If node is not found, nil is returned

Callers

nothing calls this directly

Calls 1

GetByRankRangeMethod · 0.95

Tested by

no test coverage detected