rendezvous

package module
v0.0.0-...-84eb962 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2014 License: MIT Imports: 3 Imported by: 0

README

Rendezvous

rendezvous is a Go implementation of rendezvous hashing (also known as highest random weight hashing).

This implementation is not currently Go-routine safe at all.

API documentation

Documentation

Overview

Package rendezvous implements rendezvous hashing (a.k.a. highest random weight hashing). See http://en.wikipedia.org/wiki/Rendezvous_hashing for more information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hash

type Hash struct {
	// contains filtered or unexported fields
}

func New

func New(nodes ...string) *Hash

New creates a new Hash with the given keys (optional).

func (*Hash) Add

func (h *Hash) Add(nodes ...string)

Add takes any number of nodes and adds them to this Hash.

func (*Hash) Get

func (h *Hash) Get(key string) string

Get returns the node with the highest score for the given key. If this Hash has no nodes, an empty string is returned.

func (*Hash) GetN

func (h *Hash) GetN(n int, key string) []string

GetN returns n nodes for the given key, ordered by descending score.

Jump to

Keyboard shortcuts

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