ranker

package
v0.0.0-...-b51443a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2022 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key interface {
	//1: a > other, 0: a == other, -1: a < other
	Cmp(Key) int
}

type Ranker

type Ranker struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func New

func New() *Ranker

func (*Ranker) Add

func (r *Ranker) Add(key Key, value Value)

func (*Ranker) Clear

func (r *Ranker) Clear()

func (*Ranker) Delete

func (r *Ranker) Delete(key Key)

func (*Ranker) Rank

func (r *Ranker) Rank(key Key) (rank int, value interface{})

func (*Ranker) Tops

func (r *Ranker) Tops(limit int) (keys, values []interface{})

func (*Ranker) Update

func (r *Ranker) Update(key Key, delta Value)

type Value

type Value interface {
	Add(Value) Value
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL