Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 15 for eachListItem (0.14 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/cli-runtime/pkg/printers/managedfields.go

    func (p *OmitManagedFieldsPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
    	if obj == nil {
    		return p.Delegate.PrintObj(obj, w)
    	}
    	if meta.IsListType(obj) {
    		obj = obj.DeepCopyObject()
    		_ = meta.EachListItem(obj, func(item runtime.Object) error {
    			omitManagedFields(item)
    			return nil
    		})
    	} else if _, err := meta.Accessor(obj); err == nil {
    		obj = omitManagedFields(obj.DeepCopyObject())
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Feb 16 14:52:03 UTC 2021
    - 1.6K bytes
    - Viewed (0)
  6. 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)
  7. staging/src/k8s.io/apimachinery/pkg/api/meta/table/table.go

    	if meta.IsListType(obj) {
    		rows := make([]metav1.TableRow, 0, 16)
    		err := meta.EachListItem(obj, func(obj runtime.Object) error {
    			nestedRows, err := MetaToTableRow(obj, rowFn)
    			if err != nil {
    				return err
    			}
    			rows = append(rows, nestedRows...)
    			return nil
    		})
    		if err != nil {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Nov 26 18:18:18 UTC 2019
    - 2K bytes
    - Viewed (0)
  8. staging/src/k8s.io/apiserver/pkg/registry/rest/table.go

    			Object: runtime.RawExtension{Object: obj},
    		})
    		return nil
    	}
    	switch {
    	case meta.IsListType(object):
    		if err := meta.EachListItem(object, fn); err != nil {
    			return nil, err
    		}
    	default:
    		if err := fn(object); err != nil {
    			return nil, err
    		}
    	}
    	if m, err := meta.ListAccessor(object); err == nil {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Feb 14 17:25:12 UTC 2022
    - 3.4K bytes
    - Viewed (0)
  9. staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go

    	Items []Unstructured `json:"items"`
    }
    
    func (u *UnstructuredList) GetObjectKind() schema.ObjectKind { return u }
    
    func (u *UnstructuredList) IsList() bool { return true }
    
    func (u *UnstructuredList) EachListItem(fn func(runtime.Object) error) error {
    	for i := range u.Items {
    		if err := fn(&u.Items[i]); err != nil {
    			return err
    		}
    	}
    	return nil
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sun May 28 04:46:35 UTC 2023
    - 6.3K bytes
    - Viewed (0)
  10. 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)
Back to top