consishash

package
v0.0.0-...-693abe4 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

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
}

Hash 为一个带有一致性 hash 特性的群体

func NewHash

func NewHash(nodes []string) *Hash

NewHash create a new consistant hash service

func (*Hash) AddNode

func (hash *Hash) AddNode(node Node)

AddNode 增加一个新节点

func (*Hash) Get

func (hash *Hash) Get(key string) Node

Get will execute hash action, return the node that the value should belong to

func (*Hash) RmNode

func (hash *Hash) RmNode(id string)

RmNode 删除一个节点

type Node

type Node struct {
	ID string
	// contains filtered or unexported fields
}

Node represents the real node entity in hash ring

Jump to

Keyboard shortcuts

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