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

Function RecommendedShardCount

internal/fluxshardoperator/placement.go:218–231  ·  view source on GitHub ↗

RecommendedShardCount is the raw autosizing formula: K = clamp(ceil(H / hrTargetPerShard), 1, min(maxAutoShards, T)).

(helmReleases, tenants int)

Source from the content-addressed store, hash-verified

216// RecommendedShardCount is the raw autosizing formula:
217// K = clamp(ceil(H / hrTargetPerShard), 1, min(maxAutoShards, T)).
218func RecommendedShardCount(helmReleases, tenants int) int {
219 k := (helmReleases + hrTargetPerShard - 1) / hrTargetPerShard
220 if k < 1 {
221 k = 1
222 }
223 limit := maxAutoShards
224 if tenants > 0 && tenants < limit {
225 limit = tenants
226 }
227 if k > limit {
228 k = limit
229 }
230 return k
231}
232
233// EffectiveShardCount resolves the shard count for this sync. Explicit
234// configuration wins; in auto mode the recommendation is applied with

Callers 3

EffectiveShardCountMethod · 0.85
reportMethod · 0.85

Calls

no outgoing calls

Tested by 1