Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 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/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)
  7. 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)
  8. 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)
  9. staging/src/k8s.io/apiserver/pkg/audit/request.go

    	copy := obj.DeepCopyObject()
    
    	if isAccessor {
    		if err := removeManagedFields(copy); err != nil {
    			return nil, false, err
    		}
    	}
    
    	if isList {
    		if err := meta.EachListItem(copy, removeManagedFields); err != nil {
    			return nil, false, err
    		}
    	}
    
    	if isTable {
    		table := copy.(*metav1.Table)
    		for i := range table.Rows {
    			rowObj := table.Rows[i].Object
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Jul 03 16:16:51 UTC 2023
    - 9K bytes
    - Viewed (0)
  10. staging/src/k8s.io/apimachinery/pkg/test/api_meta_help_test.go

    		},
    		{
    			in:  list4,
    			out: []interface{}{&list4.Items[0], &list4.Items[1], &list4.Items[2]},
    		},
    	}
    	for i, test := range testCases {
    		list := []runtime.Object{}
    		err := meta.EachListItem(test.in, func(obj runtime.Object) error {
    			list = append(list, obj)
    			return nil
    		})
    		if err != nil {
    			t.Fatalf("%d: each: Unexpected error %v", i, err)
    		}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 12 15:46:12 UTC 2023
    - 8.5K bytes
    - Viewed (0)
Back to top