consistent

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInsufficientMemberCount = errors.New("insufficient member count")
)

Functions

func DefaultHasher

func DefaultHasher() *hasher

Types

type Config

type Config struct {
	Load              float64
	Hasher            Hasher
	PartitionCount    int
	ReplicationFactor int
}

type Hasher

type Hasher interface {
	Sum64([]byte) uint64
}

type Member

type Member interface {
	String() string
}

type Ring

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

func New

func New(members []Member, config Config) *Ring

func (*Ring) Add

func (c *Ring) Add(member Member)

func (*Ring) AverageLoad

func (c *Ring) AverageLoad() float64

func (*Ring) FindPartitionID

func (c *Ring) FindPartitionID(key []byte) int

func (*Ring) GetClosestN

func (c *Ring) GetClosestN(key []byte, count int) ([]Member, error)

func (*Ring) GetClosestNForPartition

func (c *Ring) GetClosestNForPartition(partID, count int) ([]Member, error)

func (*Ring) GetMembers

func (c *Ring) GetMembers() []Member

func (*Ring) GetPartitionOwner

func (c *Ring) GetPartitionOwner(partID int) Member

func (*Ring) LoadDistribution

func (c *Ring) LoadDistribution() map[string]float64

func (*Ring) LocateKey

func (c *Ring) LocateKey(key []byte) Member

func (*Ring) Remove

func (c *Ring) Remove(name string)

Jump to

Keyboard shortcuts

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