goconsistencehash/hashring.go
2025-05-07 10:34:10 +08:00

22 lines
686 B
Go

package consistencehash
import "context"
type HashRing interface {
Lock(context.Context, int) error
UnLock(context.Context) error
Add(context.Context, int32, string) error
Del(context.Context, int32, string) error
Floor(context.Context, int32) (int32, error)
Ceiling(context.Context, int32) (int32, error)
Node(context.Context, int32) ([]string, error)
Nodes(context.Context) (map[string]int, error)
AddNodes(context.Context, string, int) error
DelNodes(context.Context, string) error
Datas(context.Context, string) (map[string]struct{}, error)
AddDatas(context.Context, string, map[string]struct{}) error
DelDatas(context.Context, string, map[string]struct{}) error
}