Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for eachListItem (0.16 sec)

  1. staging/src/k8s.io/apimachinery/pkg/api/meta/help.go

    // EachListItemWithAlloc works like EachListItem, but avoids retaining references to the items slice in obj.
    // It does this by making a shallow copy of non-pointer items in obj.
    //
    // If the items passed to fn are not retained, or are retained for the same duration, use EachListItem instead for memory efficiency.
    func EachListItemWithAlloc(obj runtime.Object, fn func(runtime.Object) error) error {
    	return eachListItem(obj, fn, true)
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon May 29 16:25:43 UTC 2023
    - 9.8K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apimachinery/pkg/api/meta/help_test.go

    	}
    
    	for _, tc := range tests {
    		t.Run(tc.name, func(t *testing.T) {
    			t.Run("EachListItem", func(t *testing.T) {
    				expectObjectNames := map[string]struct{}{}
    				for i := 0; i < tc.expectObjectNum; i++ {
    					expectObjectNames[strconv.Itoa(i)] = struct{}{}
    				}
    				list := tc.generateFunc(tc.expectObjectNum)
    				err := EachListItem(list, func(object runtime.Object) error {
    					o, err := Accessor(object)
    					if err != nil {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon May 29 13:40:46 UTC 2023
    - 12.1K bytes
    - Viewed (0)
  3. staging/src/k8s.io/apimachinery/pkg/runtime/testing/types.go

    			return err
    		}
    	}
    	return nil
    }
    
    func (obj *Unstructured) EachListItemWithAlloc(fn func(runtime.Object) error) error {
    	// EachListItem has allocated a new Object for the user, we can use it directly.
    	return obj.EachListItem(fn)
    }
    
    func (obj *Unstructured) NewEmptyInstance() runtime.Unstructured {
    	out := new(Unstructured)
    	if obj != nil {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sun May 28 03:26:35 UTC 2023
    - 11.5K bytes
    - Viewed (0)
  4. staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go

    	}
    
    	ret := &UnstructuredList{}
    	ret.Object = obj.Object
    
    	err := obj.EachListItem(func(item runtime.Object) error {
    		castItem := item.(*Unstructured)
    		ret.Items = append(ret.Items, *castItem)
    		return nil
    	})
    	if err != nil {
    		return nil, err
    	}
    
    	return ret, nil
    }
    
    func (obj *Unstructured) EachListItem(fn func(runtime.Object) error) error {
    	field, ok := obj.Object["items"]
    	if !ok {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sun May 28 03:26:35 UTC 2023
    - 13.7K bytes
    - Viewed (0)
  5. staging/src/k8s.io/apimachinery/pkg/runtime/interfaces.go

    	IsList() bool
    	// EachListItem should pass a single item out of the list as an Object to the provided function. Any
    	// error should terminate the iteration. If IsList() returns false, this method should return an error
    	// instead of calling the provided function.
    	EachListItem(func(Object) error) error
    	// EachListItemWithAlloc works like EachListItem, but avoids retaining references to a slice of items.
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sun May 28 03:26:35 UTC 2023
    - 19K bytes
    - Viewed (0)
  6. staging/src/k8s.io/apiserver/pkg/endpoints/handlers/response.go

    	}
    
    	gvk := groupVersion.WithKind("PartialObjectMetadata")
    	switch {
    	case groupVersion == metav1beta1.SchemeGroupVersion:
    		list := &metav1beta1.PartialObjectMetadataList{}
    		err := meta.EachListItem(result, func(obj runtime.Object) error {
    			m, err := meta.Accessor(obj)
    			if err != nil {
    				return err
    			}
    			partial := meta.AsPartialObjectMetadata(m)
    			partial.GetObjectKind().SetGroupVersionKind(gvk)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Oct 18 09:07:03 UTC 2023
    - 16.5K bytes
    - Viewed (0)
  7. istioctl/pkg/validate/validate.go

    			}
    			obj.Namespace = defaultNamespace
    		}
    
    		warnings, err := schema.ValidateConfig(*obj)
    		return warnings, err
    	}
    
    	var errs error
    	if un.IsList() {
    		_ = un.EachListItem(func(item runtime.Object) error {
    			castItem := item.(*unstructured.Unstructured)
    			if castItem.GetKind() == name.ServiceStr {
    				err := v.validateServicePortPrefix(istioNamespace, castItem)
    				if err != nil {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Jan 22 17:58:52 UTC 2024
    - 15K bytes
    - Viewed (0)
  8. staging/src/k8s.io/cli-runtime/pkg/printers/tableprinter.go

    	}}, nil
    }
    
    func printObjectMeta(obj runtime.Object, options PrintOptions) ([]metav1.TableRow, error) {
    	if meta.IsListType(obj) {
    		rows := make([]metav1.TableRow, 0, 16)
    		err := meta.EachListItem(obj, func(obj runtime.Object) error {
    			nestedRows, err := printObjectMeta(obj, options)
    			if err != nil {
    				return err
    			}
    			rows = append(rows, nestedRows...)
    			return nil
    		})
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sun Oct 30 15:08:43 UTC 2022
    - 16.7K bytes
    - Viewed (0)
Back to top