MCPcopy Create free account
hub / github.com/cozystack/cozystack / loadsOf

Function loadsOf

internal/fluxshardoperator/placement_test.go:8–16  ·  view source on GitHub ↗
(assign map[string]string, tenants []TenantInfo, k int)

Source from the content-addressed store, hash-verified

6)
7
8func loadsOf(assign map[string]string, tenants []TenantInfo, k int) []int {
9 load := make([]int, k)
10 for _, t := range tenants {
11 if idx, ok := ParseShardIndex(assign[t.Namespace]); ok && idx < k {
12 load[idx] += t.Weight
13 }
14 }
15 return load
16}
17
18func TestComputePlacementNOverNIsOnePerShard(t *testing.T) {
19 // The N-over-N guarantee from the design plan: uniform weights, N tenants

Calls 1

ParseShardIndexFunction · 0.85

Tested by

no test coverage detected