Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for allocateNext (0.17 sec)

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

    		}
    	}
    	if _, err := storage.AllocateNext(); err == nil {
    		t.Error("Allocator expected to be full")
    	}
    	// release one address in the allocated block and another a new one randomly
    	if err := storage.Release(netutils.ParseIPSloppy("192.168.1.10")); err != nil {
    		t.Fatalf("Unexpected error trying to release ip 192.168.1.10: %v", err)
    	}
    	if _, err := storage.AllocateNext(); err != nil {
    		t.Error(err)
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Aug 24 09:23:05 UTC 2023
    - 5.9K bytes
    - Viewed (0)
  2. pkg/registry/core/service/portallocator/operation_test.go

    	if err != nil {
    		t.Fatal(err)
    	}
    	for _, port := range previouslyAllocated {
    		_ = r.Allocate(port)
    	}
    	freeAtStart := r.Free()
    
    	// AllocateNext without a previously unused dry run operation
    	op := StartOperation(r, true)
    	port, err := op.AllocateNext()
    	if port == 0 {
    		t.Errorf("expected non zero port but got: %v", port)
    	}
    	if err != nil {
    		t.Errorf("expected no error but got: %v", err)
    	}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sun Aug 15 23:44:12 UTC 2021
    - 3.1K bytes
    - Viewed (0)
  3. pkg/registry/core/service/portallocator/storage/storage_test.go

    		}
    	}
    	if _, err := storage.AllocateNext(); err == nil {
    		t.Error("Allocator expected to be full")
    	}
    	// release one port in the allocated block and another a new one randomly
    	if err := storage.Release(basePortRange + 53); err != nil {
    		t.Fatalf("Unexpected error trying to release port 30053: %v", err)
    	}
    	if _, err := storage.AllocateNext(); err != nil {
    		t.Error(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)
  4. pkg/controller/nodeipam/ipam/controller_test.go

    		}
    		// Allocate until full.
    		var cidrs []*net.IPNet
    		for {
    			cidr, err := set.AllocateNext()
    			if err != nil {
    				if err == cidrset.ErrCIDRRangeNoCIDRsRemaining {
    					break
    				}
    				t.Errorf("set.AllocateNext() = %v, want %v", err, cidrset.ErrCIDRRangeNoCIDRsRemaining)
    				continue TestCase
    			}
    			cidrs = append(cidrs, cidr)
    		}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Jan 04 20:48:08 UTC 2018
    - 1.9K bytes
    - Viewed (0)
  5. pkg/registry/core/service/allocator/storage/storage.go

    		}
    		return false, err
    	}
    	return true, nil
    }
    
    // AllocateNext attempts to allocate the next item.
    func (e *Etcd) AllocateNext() (int, bool, error) {
    	e.lock.Lock()
    	defer e.lock.Unlock()
    	var offset int
    	var ok bool
    	var err error
    
    	err = e.tryUpdate(func() error {
    		// update the offset here
    		offset, ok, err = e.alloc.AllocateNext()
    		if err != nil {
    			return err
    		}
    		if !ok {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Aug 24 09:23:05 UTC 2023
    - 6.5K bytes
    - Viewed (0)
  6. pkg/registry/core/service/portallocator/allocator.go

    	r.metrics.setAllocated(r.Used())
    	r.metrics.setAvailable(r.Free())
    
    	return nil
    }
    
    // AllocateNext reserves one of the ports from the pool. ErrFull may
    // be returned if there are no ports left.
    func (r *PortAllocator) AllocateNext() (int, error) {
    	offset, ok, err := r.alloc.AllocateNext()
    	if err != nil {
    		r.metrics.incrementAllocationErrors("dynamic")
    		return 0, err
    	}
    	if !ok {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 08 07:15:02 UTC 2024
    - 7.4K bytes
    - Viewed (0)
  7. pkg/registry/core/service/portallocator/operation.go

    	err := op.pa.Allocate(port)
    	if err == nil {
    		op.allocated = append(op.allocated, port)
    	}
    	return err
    }
    
    // Allocates a port, and record it for future rollback
    func (op *PortAllocationOperation) AllocateNext() (int, error) {
    	if op.dryRun {
    		// Find the max element of the allocated ports array.
    		// If no ports are already being allocated by this operation,
    		// then choose a sensible guess for a dummy port number
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Jul 26 17:14:05 UTC 2022
    - 4.2K bytes
    - Viewed (0)
  8. pkg/registry/core/service/allocator/bitmap.go

    		return false, nil
    	}
    	r.allocated = r.allocated.SetBit(r.allocated, offset, 1)
    	r.count++
    	return true, nil
    }
    
    // AllocateNext reserves one of the items from the pool.
    // (0, false, nil) may be returned if there are no items left.
    func (r *AllocationBitmap) AllocateNext() (int, bool, error) {
    	r.lock.Lock()
    	defer r.lock.Unlock()
    
    	next, ok := r.strategy.AllocateBit(r.allocated, r.max, r.count)
    	if !ok {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jan 25 20:32:40 UTC 2023
    - 7.6K bytes
    - Viewed (0)
  9. pkg/registry/core/service/allocator/interfaces.go

    limitations under the License.
    */
    
    package allocator
    
    // Interface manages the allocation of items out of a range. Interface
    // should be threadsafe.
    type Interface interface {
    	Allocate(int) (bool, error)
    	AllocateNext() (int, bool, error)
    	Release(int) error
    	ForEach(func(int))
    	Has(int) bool
    	Free() int
    
    	// Destroy shuts down all internal structures.
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon May 22 10:35:43 UTC 2023
    - 1.4K bytes
    - Viewed (0)
  10. pkg/registry/core/service/ipallocator/interfaces.go

    	"net"
    
    	api "k8s.io/kubernetes/pkg/apis/core"
    )
    
    // Interface manages the allocation of IP addresses out of a range. Interface
    // should be threadsafe.
    type Interface interface {
    	Allocate(net.IP) error
    	AllocateNext() (net.IP, error)
    	Release(net.IP) error
    	ForEach(func(net.IP))
    	CIDR() net.IPNet
    	IPFamily() api.IPFamily
    	Has(ip net.IP) bool
    	Destroy()
    	EnableMetrics()
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Oct 31 21:05:04 UTC 2023
    - 1.6K bytes
    - Viewed (0)
Back to top