consistenthash

package
v0.0.0-...-4841b2c Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HashFn

type HashFn func([]byte) uint32

HashFn hashs bytes to uint32

type Map

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

Map contains all hashed keys

func New

func New(replicas int, fn HashFn) *Map

New creates an instance of Map which stores all hashed keys

func (*Map) Add

func (m *Map) Add(keys ...string)

Add adds some keys to the hash a key represent a real pear

func (*Map) Get

func (m *Map) Get(keys string) string

Get gets the closest item in the hash to the provided key

Jump to

Keyboard shortcuts

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