hashring

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

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

Go to latest
Published: Jan 25, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

README

hashring

Godoc Go Report Card Build Status codecov

Go consistent hash ring with vnodes

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ring

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

Ring is a consistent hash ring with the specified vnodes per host.

func New

func New(hostnames []string, vnodes int) *Ring

New initialise a consistent hash ring with the specified vnodes per host.

func (*Ring) Add

func (r *Ring) Add(h string)

Add the supplied hostname to the ring.

func (*Ring) Bucket

func (r *Ring) Bucket(input string) string

Bucket indicates which hostname the input is routed to.

func (*Ring) Remove

func (r *Ring) Remove(h string)

Remove the supplied hostname from the ring.

Jump to

Keyboard shortcuts

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