Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for NewInMemory (0.09 sec)

  1. pkg/registry/core/service/portallocator/operation_test.go

    	pr, err := net.ParsePortRange("10000-10200")
    	if err != nil {
    		t.Fatal(err)
    	}
    
    	// Allocate some ports before calling
    	previouslyAllocated := []int{10000, 10010, 10020}
    	r, err := NewInMemory(*pr)
    	if err != nil {
    		t.Fatal(err)
    	}
    	for _, port := range previouslyAllocated {
    		_ = r.Allocate(port)
    	}
    	freeAtStart := r.Free()
    
    	// Do some allocations with a dry run operation
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sun Aug 15 23:44:12 UTC 2021
    - 3.1K bytes
    - Viewed (0)
  2. pkg/registry/core/service/portallocator/allocator.go

    	}
    
    	var err error
    	a.alloc, err = allocatorFactory(max, rangeSpec, calculateRangeOffset(pr))
    	if err != nil {
    		return nil, err
    	}
    
    	return a, err
    }
    
    // NewInMemory creates an in-memory allocator.
    func NewInMemory(pr net.PortRange) (*PortAllocator, error) {
    	return New(pr, func(max int, rangeSpec string, offset int) (allocator.Interface, error) {
    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