Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for ObserveExpressionCost (0.31 sec)

  1. staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/validation/cel_validation.go

    	// that accumulate at least 1% of total cost limit are included.
    	MostExpensive []RuleCost
    }
    
    // ObserveExpressionCost accumulates the cost of evaluating a -kubernetes-validations rule.
    func (c *TotalCost) ObserveExpressionCost(path *field.Path, cost uint64) {
    	if math.MaxUint64-c.Total < cost {
    		c.Total = math.MaxUint64
    	} else {
    		c.Total += cost
    	}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Oct 10 22:05:55 UTC 2022
    - 13.8K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/validation/validation.go

    						}
    						if celContext.TotalCost != nil {
    							celContext.TotalCost.ObserveExpressionCost(fldPath.Child("x-kubernetes-validations").Index(i).Child("rule"), expressionCost)
    						}
    						if cr.Error != nil {
    							if cr.Error.Type == apiservercel.ErrorTypeRequired {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri May 10 22:07:40 UTC 2024
    - 82.6K bytes
    - Viewed (0)
  3. staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/validation/validation_test.go

    		},
    	}
    	for _, tt := range tests {
    		t.Run(tt.name, func(t *testing.T) {
    			crdCost := TotalCost{}
    			for _, cost := range tt.costs {
    				crdCost.ObserveExpressionCost(nil, cost)
    			}
    			if len(crdCost.MostExpensive) != len(tt.expectedExpensive) {
    				t.Fatalf("expected %d largest costs but got %d: %v", len(tt.expectedExpensive), len(crdCost.MostExpensive), crdCost.MostExpensive)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri May 10 22:07:40 UTC 2024
    - 349.4K bytes
    - Viewed (0)
Back to top