zslot

package
v0.0.0-...-031d970 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SlotCluster

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

SlotCluster is a map to return service host

func NewSlotCluster

func NewSlotCluster(conn *zk.Conn) SlotCluster

NewSlotCluster is a help function, we will try to read from the zk, if it is not existed, we will init it and dispatch all to default service

func (*SlotCluster) Dispatch

func (sc *SlotCluster) Dispatch(begin uint32, end uint32, service string) error

Dispatch will let some slot belong to some service

func (*SlotCluster) Hash

func (sc *SlotCluster) Hash(Key string) (string, error)

Hash will hash Key and mod TotalSlotsNum, choose a slot and return

Jump to

Keyboard shortcuts

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