hashring

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

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

Go to latest
Published: Sep 21, 2017 License: MIT Imports: 4 Imported by: 0

README

hashring

Hashring with efficient implementation

GoDoc

This implementation is partially derived from https://github.com/serialx/hashring

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binary

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

func NewBinary

func NewBinary(b []byte) Binary

func (Binary) Md5

func (b Binary) Md5() [md5.Size]byte

func (Binary) String

func (b Binary) String() string

func (Binary) ToBytes

func (b Binary) ToBytes(prefix []byte) []byte

type HashRing

type HashRing struct {
	Table []RingNode
	// contains filtered or unexported fields
}

func (*HashRing) GenerateCircle

func (h *HashRing) GenerateCircle()

This code is partially derived from https://github.com/serialx/hashring

func (*HashRing) GetAllNodePositions

func (h *HashRing) GetAllNodePositions(b Binary, out []int, begin int) bool

func (*HashRing) GetNodePosition

func (h *HashRing) GetNodePosition(b Binary) int

func (*HashRing) GetNodePositionIterative

func (h *HashRing) GetNodePositionIterative(b Binary, iteration int) int

type RingNode

type RingNode struct {
	Key    Binary
	Value  interface{}
	Weigth int
}

Jump to

Keyboard shortcuts

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