MCPcopy Create free account
hub / github.com/cortexproject/cortex / SmallestPositiveIntPerTenant

Function SmallestPositiveIntPerTenant

pkg/util/validation/limits.go:1178–1190  ·  view source on GitHub ↗

SmallestPositiveIntPerTenant is returning the minimal positive value of the supplied limit function for all given tenants.

(tenantIDs []string, f func(string) int)

Source from the content-addressed store, hash-verified

1176// SmallestPositiveIntPerTenant is returning the minimal positive value of the
1177// supplied limit function for all given tenants.
1178func SmallestPositiveIntPerTenant(tenantIDs []string, f func(string) int) int {
1179 var result *int
1180 for _, tenantID := range tenantIDs {
1181 v := f(tenantID)
1182 if result == nil || v < *result {
1183 result = &v
1184 }
1185 }
1186 if result == nil {
1187 return 0
1188 }
1189 return *result
1190}
1191
1192// SmallestPositiveNonZeroFloat64PerTenant is returning the minimal positive and
1193// non-zero value of the supplied limit function for all given tenants. In many

Callers 4

DoMethod · 0.92
DoRequestsFunction · 0.92
getMaxVerticalShardSizeFunction · 0.92

Calls

no outgoing calls

Tested by 1