Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for NewInMemory (0.17 sec)

  1. pkg/registry/core/service/ipallocator/bitmap_test.go

    	}
    
    	_, otherCidr, err := netutils.ParseCIDRSloppy("192.168.2.0/24")
    	if err != nil {
    		t.Fatal(err)
    	}
    	_, err = NewInMemory(otherCidr)
    	if err != nil {
    		t.Fatal(err)
    	}
    	if err := r.Restore(otherCidr, dst.Data); err != ErrMismatchedNetwork {
    		t.Fatal(err)
    	}
    	other, err := NewInMemory(network)
    	if err != nil {
    		t.Fatal(err)
    	}
    	if err := other.Restore(network, dst.Data); err != nil {
    		t.Fatal(err)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jan 25 20:32:40 UTC 2023
    - 21.1K bytes
    - Viewed (0)
  2. pkg/registry/core/service/portallocator/allocator_test.go

    	}
    
    	otherPr, err := net.ParsePortRange("200-300")
    	if err != nil {
    		t.Fatal(err)
    	}
    	_, err = NewInMemory(*otherPr)
    	if err != nil {
    		t.Fatal(err)
    	}
    	if err := r.Restore(*otherPr, dst.Data); err != ErrMismatchedNetwork {
    		t.Fatal(err)
    	}
    	other, err := NewInMemory(*pr2)
    	if err != nil {
    		t.Fatal(err)
    	}
    	if err := other.Restore(*pr2, dst.Data); err != nil {
    		t.Fatal(err)
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 08 07:15:02 UTC 2024
    - 14K bytes
    - Viewed (0)
  3. 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)
  4. pkg/registry/core/service/ipallocator/controller/repair_test.go

    	clearMetrics()
    	_, cidr, _ := netutils.ParseCIDRSloppy("192.168.1.0/24")
    	previous, err := ipallocator.NewInMemory(cidr)
    	if err != nil {
    		t.Fatal(err)
    	}
    
    	previous.Allocate(netutils.ParseIPSloppy("192.168.1.10"))
    
    	_, secondaryCIDR, _ := netutils.ParseCIDRSloppy("2000::/108")
    	secondaryPrevious, err := ipallocator.NewInMemory(secondaryCIDR)
    	if err != nil {
    		t.Fatal(err)
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sat Sep 30 15:46:06 UTC 2023
    - 21.1K bytes
    - Viewed (0)
  5. 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)
  6. pkg/registry/core/service/ipallocator/bitmap.go

    	var err error
    	r.alloc, err = allocatorFactory(r.max, rangeSpec, offset)
    	if err != nil {
    		return nil, err
    	}
    	return &r, nil
    }
    
    // NewInMemory creates an in-memory allocator.
    func NewInMemory(cidr *net.IPNet) (*Range, error) {
    	return New(cidr, func(max int, rangeSpec string, offset int) (allocator.Interface, error) {
    		return allocator.NewAllocationMapWithOffset(max, rangeSpec, offset), nil
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jan 25 20:32:40 UTC 2023
    - 10.8K bytes
    - Viewed (0)
  7. pkg/registry/core/service/portallocator/controller/repair_test.go

    		t.Fatalf("1 error expected, got %v", repairErrors)
    	}
    }
    
    func TestRepairLeak(t *testing.T) {
    	clearMetrics()
    
    	pr, _ := net.ParsePortRange("100-200")
    	previous, err := portallocator.NewInMemory(*pr)
    	if err != nil {
    		t.Fatal(err)
    	}
    	previous.Allocate(111)
    
    	var dst api.RangeAllocation
    	err = previous.Snapshot(&dst)
    	if err != nil {
    		t.Fatal(err)
    	}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sat Sep 30 15:46:06 UTC 2023
    - 10.6K bytes
    - Viewed (0)
  8. pkg/registry/core/service/portallocator/controller/repair.go

    	if err != nil {
    		return fmt.Errorf("unable to refresh the port block: %v", err)
    	}
    
    	rebuilt, err := portallocator.NewInMemory(c.portRange)
    	if err != nil {
    		return fmt.Errorf("unable to create port allocator: %v", err)
    	}
    	// Check every Service's ports, and rebuild the state as we think it should be.
    	for i := range list.Items {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sat Sep 30 15:46:06 UTC 2023
    - 10.4K bytes
    - Viewed (0)
  9. pkg/registry/core/service/ipallocator/controller/repair.go

    		}
    
    		storedByFamily[family] = stored
    	}
    
    	rebuiltByFamily := make(map[v1.IPFamily]*ipallocator.Range)
    
    	for family, network := range c.networkByFamily {
    		rebuilt, err := ipallocator.NewInMemory(network)
    		if err != nil {
    			return fmt.Errorf("unable to create CIDR range for family %v: %v", family, err)
    		}
    
    		rebuiltByFamily[family] = rebuilt
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sat Sep 30 15:46:06 UTC 2023
    - 13.8K bytes
    - Viewed (0)
  10. pkg/registry/core/service/storage/storage_test.go

    }
    
    func makeIPAllocator(cidr *net.IPNet) ipallocator.Interface {
    	al, err := ipallocator.NewInMemory(cidr)
    	if err != nil {
    		panic(fmt.Sprintf("error creating IP allocator: %v", err))
    	}
    	return al
    }
    
    func makePortAllocator(ports machineryutilnet.PortRange) portallocator.Interface {
    	al, err := portallocator.NewInMemory(ports)
    	if err != nil {
    		panic(fmt.Sprintf("error creating port allocator: %v", err))
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 24 18:25:29 UTC 2024
    - 440.2K bytes
    - Viewed (0)
Back to top