Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 423 for Allocate (0.14 sec)

  1. 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)
  2. 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)
  3. 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)
  4. 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)
  5. 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)
  6. 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)
  7. 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)
  8. pkg/registry/core/service/allocator/storage/storage.go

    		baseKey:   baseKey,
    		resource:  config.GroupResource,
    		destroyFn: func() { once.Do(d) },
    	}, nil
    }
    
    // Allocate attempts to allocate the item.
    func (e *Etcd) Allocate(offset int) (bool, error) {
    	e.lock.Lock()
    	defer e.lock.Unlock()
    
    	err := e.tryUpdate(func() error {
    		ok, err := e.alloc.Allocate(offset)
    		if err != nil {
    			return err
    		}
    		if !ok {
    			return errorUnableToAllocate
    		}
    		return nil
    	})
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Aug 24 09:23:05 UTC 2023
    - 6.5K bytes
    - Viewed (0)
  9. pkg/kubelet/cm/devicemanager/endpoint.go

    				AllocationSize:       int32(size),
    			},
    		},
    	})
    }
    
    // allocate issues Allocate gRPC call to the device plugin.
    func (e *endpointImpl) allocate(devs []string) (*pluginapi.AllocateResponse, error) {
    	if e.isStopped() {
    		return nil, fmt.Errorf(errEndpointStopped, e)
    	}
    	return e.api.Allocate(context.Background(), &pluginapi.AllocateRequest{
    		ContainerRequests: []*pluginapi.ContainerAllocateRequest{
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Nov 02 11:05:20 UTC 2022
    - 3.9K bytes
    - Viewed (0)
  10. pkg/registry/core/service/allocator/bitmap.go

    			rand:   rand.New(rand.NewSource(time.Now().UnixNano())),
    			offset: offset,
    		},
    		allocated: big.NewInt(0),
    		count:     0,
    		max:       max,
    		rangeSpec: rangeSpec,
    	}
    
    	return &a
    }
    
    // Allocate attempts to reserve the provided item.
    // Returns true if it was allocated, false if it was already in use
    func (r *AllocationBitmap) Allocate(offset int) (bool, error) {
    	r.lock.Lock()
    	defer r.lock.Unlock()
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jan 25 20:32:40 UTC 2023
    - 7.6K bytes
    - Viewed (0)
Back to top