Documentation
¶
Index ¶
- type Dump
- type GetByKeyRangeOptions
- type Level
- type Node
- type SortedSet
- func (s *SortedSet[K, V]) Contains(value V) bool
- func (s *SortedSet[K, V]) Dump(makeDump func(key K, value V) (string, string, error)) (string, error)
- func (s *SortedSet[K, V]) FindRank(value V) int
- func (s *SortedSet[K, V]) GetByKeyRange(start K, end K, options *GetByKeyRangeOptions) []*Node[K, V]
- func (s *SortedSet[K, V]) GetByRank(rank int, remove bool) *Node[K, V]
- func (s *SortedSet[K, V]) GetByRankRange(start int, end int, remove bool) []*Node[K, V]
- func (s *SortedSet[K, V]) GetByValue(value V) *Node[K, V]
- func (s *SortedSet[K, V]) GetCount() int
- func (s *SortedSet[K, V]) GetRTop(count int, remove bool) (result []*Node[K, V])
- func (s *SortedSet[K, V]) GetTop(count int, remove bool) (result []*Node[K, V])
- func (s *SortedSet[K, V]) GetUntilKey(untilKey K, remove bool) []any
- func (s *SortedSet[K, V]) PeekMax() *Node[K, V]
- func (s *SortedSet[K, V]) PeekMin() *Node[K, V]
- func (s *SortedSet[K, V]) PopMax() *Node[K, V]
- func (s *SortedSet[K, V]) PopMin() *Node[K, V]
- func (s *SortedSet[K, V]) Remove(value V) *Node[K, V]
- func (s *SortedSet[K, V]) Restore(keyRestore func(key string, values []string) (K, []V, error), dump string) error
- func (s *SortedSet[K, V]) Upsert(key K, value V) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GetByKeyRangeOptions ¶
type Level ¶
type Level[K comparable, V comparable] struct { // contains filtered or unexported fields }
type Node ¶
type Node[K comparable, V comparable] struct { // contains filtered or unexported fields }
type SortedSet ¶
type SortedSet[K comparable, V comparable] struct { // contains filtered or unexported fields }
func NewSortedSet ¶
func NewSortedSet[K comparable, V comparable](c comparator.Comparator) *SortedSet[K, V]
func (*SortedSet[K, V]) FindRank ¶
FindRank find the rank of the node specified by key Note that the rank is 1-based integer. Rank 1 means the first node If the node is not found, 0 is returned. Otherwise rank(> 0) is returned Time complexity of this method is : O(log(N))
func (*SortedSet[K, V]) GetByKeyRange ¶
func (s *SortedSet[K, V]) GetByKeyRange(start K, end K, options *GetByKeyRangeOptions) []*Node[K, V]
GetByKeyRange get the nodes whose key within the specific range If options is nil, it `searches` in interval [start, end] without any limit by default Time complexity of this method is : O(log(N))
func (*SortedSet[K, V]) GetByRank ¶
GetByRank get node by 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))
func (*SortedSet[K, V]) GetByRankRange ¶
GetByRankRange get nodes within specific rank range [start, end] Note that the rank is 1-based integer. Rank 1 means the first node; Rank -1 means the last node; If start is greater than end, the returned array is in reserved order If remove is true, the returned nodes are removed Time complexity of this method is : O(log(N))
func (*SortedSet[K, V]) GetByValue ¶
GetByValue get node by value If node is not found, nil is returned Time complexity : O(1)
func (*SortedSet[K, V]) GetUntilKey ¶
GetUntilKey get all values until given key
func (*SortedSet[K, V]) PeekMax ¶
PeekMax get the element with maximum key, nil if the set is empty Time Complexity : O(1)
func (*SortedSet[K, V]) PeekMin ¶
PeekMin get the element with minimum key, nil if the set is empty Time complexity of this method is : O(log(N))
func (*SortedSet[K, V]) PopMax ¶
PopMax get and remove the element with maximum key, nil if the set is empty Time complexity of this method is : O(log(N))
func (*SortedSet[K, V]) PopMin ¶
PopMin get and remove the element with minimal key, nil if the set is empty Time complexity of this method is : O(log(N))
func (*SortedSet[K, V]) Remove ¶
Remove delete element specified by key Time complexity of this method is : O(log(N))