MCPcopy Create free account
hub / github.com/cel-expr/cel-go / estimateNetworkContainsCIDRStringCost

Function estimateNetworkContainsCIDRStringCost

ext/network.go:727–739  ·  view source on GitHub ↗
(estimator cost.Estimator, target *cost.AstNode, args []cost.AstNode)

Source from the content-addressed store, hash-verified

725}
726
727func estimateNetworkContainsCIDRStringCost(estimator cost.Estimator, target *cost.AstNode, args []cost.AstNode) *cost.CallEstimate {
728 if len(args) < 1 {
729 return nil
730 }
731 sz := cost.RangedSizeEstimate(4, 16)
732 ipCompCost := sz.Add(sz).MultiplyByCostFactor(cost.StringCostFactor)
733 ipCompCost = ipCompCost.Add(sz.MultiplyByCostFactor(cost.StringCostFactor))
734 argSz := cost.EstimateSize(estimator, args[0])
735 ipCompCost = ipCompCost.Add(argSz.MultiplyByCostFactor(cost.StringCostFactor))
736 // K8s adds one for the extra IP traversal
737 ipCompCost = ipCompCost.Add(cost.CallCostEstimate)
738 return cost.NewCallEstimate(ipCompCost, nil)
739}
740
741// Runtime cost tracking functions for network extensions.
742

Callers

nothing calls this directly

Calls 5

RangedSizeEstimateFunction · 0.92
EstimateSizeFunction · 0.92
NewCallEstimateFunction · 0.92
AddMethod · 0.65
MultiplyByCostFactorMethod · 0.45

Tested by

no test coverage detected