Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 463 for Allocate (0.2 sec)

  1. pkg/registry/core/service/allocator/storage/storage_test.go

    	// Allocate an item in the storage
    	if _, err := storage.Allocate(2); err != nil {
    		t.Fatal(err)
    	}
    
    	// Release the item in the local bitmap
    	// emulating it's out of sync with the storage
    	err := backing.Release(2)
    	if err != nil {
    		t.Fatal(err)
    	}
    
    	// It should fail trying to allocate it deespite it's free
    	// in the local bitmap because it's not in the storage
    	ok, err := storage.Allocate(2)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Sep 01 20:54:26 UTC 2021
    - 4.8K bytes
    - Viewed (0)
  2. pkg/registry/core/service/portallocator/storage/storage_test.go

    		t.Fatalf("unexpected error: %v", err)
    	}
    
    	// Allocate a port inside the valid port range
    	if err := storage.Allocate(30100); err != nil {
    		t.Fatal(err)
    	}
    
    	// Try to allocate the same port in the local bitmap
    	// The local bitmap stores the offset of the port
    	// offset = port - base (30100 - 30000 = 100)
    	ok, err := backing.Allocate(100)
    	if err != nil {
    		t.Fatal(err)
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 08 07:15:02 UTC 2024
    - 8.1K bytes
    - Viewed (0)
  3. pkg/registry/core/service/portallocator/operation.go

    		return nil
    	}
    
    	return errors
    }
    
    // Allocates a port, and record it for future rollback
    func (op *PortAllocationOperation) Allocate(port int) error {
    	if op.dryRun {
    		if op.pa.Has(port) {
    			return ErrAllocated
    		}
    		for _, a := range op.allocated {
    			if port == a {
    				return ErrAllocated
    			}
    		}
    		op.allocated = append(op.allocated, port)
    		return nil
    	}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Jul 26 17:14:05 UTC 2022
    - 4.2K bytes
    - Viewed (0)
  4. pkg/registry/core/service/ipallocator/storage/storage_test.go

    		if !storage.Has(netutils.ParseIPSloppy(ip)) {
    			t.Errorf("IP %s expected to be allocated", ip)
    		}
    	}
    
    	// allocate all addresses on the static block
    	for i := 0; i < dynamicOffset; i++ {
    		ip := fmt.Sprintf("192.168.1.%d", i+1)
    		if err := storage.Allocate(netutils.ParseIPSloppy(ip)); err != nil {
    			t.Errorf("Unexpected error trying to allocate IP %s: %v", ip, err)
    		}
    	}
    	if _, err := storage.AllocateNext(); err == nil {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Aug 24 09:23:05 UTC 2023
    - 5.9K bytes
    - Viewed (0)
  5. staging/src/k8s.io/apimachinery/pkg/runtime/allocator_test.go

    	target := &Allocator{}
    
    	for i := 0; i < iterations; i++ {
    		bytesToAllocate := rand.Intn(maxBytes)
    		buff := target.Allocate(uint64(bytesToAllocate))
    		if cap(buff) < bytesToAllocate {
    			t.Fatalf("expected the buffer to allocate: %v bytes whereas it allocated: %v bytes", bytesToAllocate, cap(buff))
    		}
    		if len(buff) != bytesToAllocate {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Feb 23 13:38:29 UTC 2022
    - 2.4K bytes
    - Viewed (0)
  6. pkg/registry/core/service/portallocator/operation_test.go

    	if err != nil {
    		t.Errorf("expected no error but got: %v", err)
    	}
    
    	// Try to allocate the returned port using the same operation
    	if e, a := ErrAllocated, op.Allocate(port); e != a {
    		t.Errorf("expected %v but got: %v", e, a)
    	}
    
    	// AllocateNext with a previously used dry run operation
    	op = StartOperation(r, true)
    	_ = op.Allocate(12345)
    	port, err = op.AllocateNext()
    	if port == 0 {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sun Aug 15 23:44:12 UTC 2021
    - 3.1K bytes
    - Viewed (0)
  7. staging/src/k8s.io/apimachinery/pkg/runtime/allocator.go

    	},
    }
    
    // Allocator knows how to allocate memory
    // It exists to make the cost of object serialization cheaper.
    // In some cases, it allows for allocating memory only once and then reusing it.
    // This approach puts less load on GC and leads to less fragmented memory in general.
    type Allocator struct {
    	buf []byte
    }
    
    var _ MemoryAllocator = &Allocator{}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jul 27 03:17:50 UTC 2022
    - 2.2K bytes
    - Viewed (0)
  8. pkg/scheduler/framework/plugins/dynamicresources/structured/namedresources/namedresourcesmodel.go

    }
    
    func (c *Controller) NodeIsSuitable(ctx context.Context, model Model) (bool, error) {
    	indices, err := c.allocate(ctx, model)
    	return len(indices) == len(c.requests), err
    }
    
    func (c *Controller) Allocate(ctx context.Context, model Model) ([]*resourceapi.NamedResourcesAllocationResult, error) {
    	indices, err := c.allocate(ctx, model)
    	if err != nil {
    		return nil, err
    	}
    	if len(indices) != len(c.requests) {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Mar 07 21:26:16 UTC 2024
    - 4.5K bytes
    - Viewed (0)
  9. src/runtime/traceregion.go

    		}
    
    		// Add the existing block to the full list.
    		block.next = a.full
    		a.full = block
    	}
    
    	// Allocate a new block.
    	block = (*traceRegionAllocBlock)(sysAlloc(unsafe.Sizeof(traceRegionAllocBlock{}), &memstats.other_sys))
    	if block == nil {
    		throw("traceRegion: out of memory")
    	}
    
    	// Allocate space for our current request, so we always make
    	// progress.
    	block.off.Store(n)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 08 17:47:01 UTC 2024
    - 3.2K bytes
    - Viewed (0)
  10. pkg/registry/core/service/portallocator/allocator.go

    		// include valid port range in error
    		validPorts := r.portRange.String()
    		return &ErrNotInRange{validPorts}
    	}
    
    	allocated, err := r.alloc.Allocate(offset)
    	if err != nil {
    		// update metrics
    		r.metrics.incrementAllocationErrors("static")
    		return err
    	}
    	if !allocated {
    		// update metrics
    		r.metrics.incrementAllocationErrors("static")
    		return ErrAllocated
    	}
    
    	// update metrics
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 08 07:15:02 UTC 2024
    - 7.4K bytes
    - Viewed (0)
Back to top