consistenthash

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2023 License: Apache-2.0 Imports: 6 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
}

func New

func New(opts ...Option) *Hash

func (*Hash) Add

func (h *Hash) Add(nodes ...string)

func (*Hash) Get

func (h *Hash) Get(key string) string

func (*Hash) Name

func (h *Hash) Name() string

func (*Hash) Remove

func (h *Hash) Remove(key string)

type HashFunc

type HashFunc func(data []byte) uint32

type Option

type Option func(o *Options)

func WithHashFunc

func WithHashFunc(hashFunc HashFunc) Option

WithHashFunc define your hash function

func WithReplicationFactor

func WithReplicationFactor(factor int) Option

WithReplicationFactor define consistent hash replication factor

type Options

type Options struct {
	HashFunc          HashFunc
	ReplicationFactor int
}

Options TODO: options should be allowed to edit to user

Jump to

Keyboard shortcuts

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