core

package
v0.0.0-...-731d936 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultVirtualNodeReplicas = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HashRing

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

HashRing contains all hashed keys

func New

func New(replicas int, fn HashStrategy) *HashRing

实例化

func (*HashRing) AddNode

func (h *HashRing) AddNode(key string, weight int)

func (*HashRing) AddNodes

func (h *HashRing) AddNodes(nodes NodeList)

func (*HashRing) Locate

func (h *HashRing) Locate(s string) string

func (*HashRing) RemoveNode

func (h *HashRing) RemoveNode(key string)

type HashStrategy

type HashStrategy func(data []byte) uint32

HashStrategy maps bytes to uint32

type Node

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

type NodeList

type NodeList []Node

func (NodeList) Len

func (n NodeList) Len() int

func (NodeList) Less

func (n NodeList) Less(i, j int) bool

func (NodeList) Sort

func (n NodeList) Sort()

func (NodeList) Swap

func (n NodeList) Swap(i, j int)

Jump to

Keyboard shortcuts

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