ring

package module
v0.0.0-...-ce99fcd Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2019 License: MIT Imports: 5 Imported by: 0

README

Ring

Consistent hashing paper implementation using Red Black Tree ring

Example Usage

ring:=NewRing([]string{"server-1","server-2","server-3"},1)
node:=ring.Get("foo")

TODO

  • More test cases
  • Performance test for xxhash

Paper

https://www.akamai.com/es/es/multimedia/documents/technical-publication/consistent-hashing-and-random-trees-distributed-caching-protocols-for-relieving-hot-spots-on-the-world-wide-web-technical-publication.pdf

Ring Image source: http://paperplanes-assets.s3.amazonaws.com/consistent-hashing.png

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ERR_EMPTY_RING    = errors.New("empty ring")
	ERR_KEY_NOT_FOUND = errors.New("key not found")
)

Functions

This section is empty.

Types

type Ring

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

func New

func New() *Ring

func NewRing

func NewRing(nodes []string, virtualNodes int) *Ring

func (*Ring) Add

func (r *Ring) Add(node string)

func (*Ring) Get

func (r *Ring) Get(key string) (string, error)

func (*Ring) Remove

func (r *Ring) Remove(node string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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