未验证 提交 6322eb31 编写于 作者: S shaoyue 提交者: GitHub

[skip ci] Add comments for exported things in policy.go (#11876)

Signed-off-by: Nshaoyue.chen <shaoyue.chen@zilliz.com>
上级 887f9e01
......@@ -315,6 +315,7 @@ func AvgAssignUnregisteredChannels(store ROChannelStore, nodeID int64) ChannelOp
return opSet
}
// ConsistentHashDeregisterPolicy return a DeregisterPolicy that uses consistent hash
func ConsistentHashDeregisterPolicy(hashring *consistent.Consistent) DeregisterPolicy {
return func(store ROChannelStore, nodeID int64) ChannelOpSet {
hashring.Set(formatNodeIDsWithFilter(store.GetNodes(), nodeID))
......@@ -365,12 +366,15 @@ func ConsistentHashDeregisterPolicy(hashring *consistent.Consistent) DeregisterP
}
}
// ChannelReassignPolicy is a policy for reassigning channels
type ChannelReassignPolicy func(store ROChannelStore, reassigns []*NodeChannelInfo) ChannelOpSet
// EmptyReassignPolicy is a dummy reassign policy
func EmptyReassignPolicy(store ROChannelStore, reassigns []*NodeChannelInfo) ChannelOpSet {
return nil
}
// AverageReassignPolicy is a reassign policy that evenly assign channels
func AverageReassignPolicy(store ROChannelStore, reassigns []*NodeChannelInfo) ChannelOpSet {
channels := store.GetNodesChannels()
filterMap := make(map[int64]struct{})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册