Versions in this module Expand all Collapse all v1 v1.0.2 Sep 16, 2024 Changes in this version + var ErrHostNotFound = errors.New("host not found") + var ErrNoHost = errors.New("no host added") + type Config struct + HashFunction func() hash.Hash64 + LoadFactor float64 + ReplicationFactor int + type ConsistentHashing struct + func NewWithConfig(cfg Config) (*ConsistentHashing, error) + func (c *ConsistentHashing) Add(ctx context.Context, host string) error + func (c *ConsistentHashing) DecreaseLoad(ctx context.Context, host string) error + func (c *ConsistentHashing) Get(ctx context.Context, key string) (string, error) + func (c *ConsistentHashing) GetLeast(ctx context.Context, key string) (string, error) + func (c *ConsistentHashing) GetLoads() map[string]int64 + func (c *ConsistentHashing) Hash(key string) (uint64, error) + func (c *ConsistentHashing) Hosts() []string + func (c *ConsistentHashing) IncreaseLoad(ctx context.Context, host string) error + func (c *ConsistentHashing) LoadOk(host string) bool + func (c *ConsistentHashing) MaxLoad() int64 + func (c *ConsistentHashing) Remove(ctx context.Context, host string) error + func (c *ConsistentHashing) Search(key uint64) (int, error) + func (c *ConsistentHashing) UpdateLoad(ctx context.Context, host string, load int64) error + type Host struct + Load int64 + Name string v1.0.0 Jul 7, 2024