kubernetes/pkg/registry/core/service/ipallocator/bitmap.go

type Range

var _

// New creates a Range over a net.IPNet, calling allocatorFactory to construct the backing store.
func New(cidr *net.IPNet, allocatorFactory allocator.AllocatorWithOffsetFactory) (*Range, error) {}

// NewInMemory creates an in-memory allocator.
func NewInMemory(cidr *net.IPNet) (*Range, error) {}

// NewFromSnapshot allocates a Range and initializes it from a snapshot.
func NewFromSnapshot(snap *api.RangeAllocation) (*Range, error) {}

func maximum(a, b int) int {}

// Free returns the count of IP addresses left in the range.
func (r *Range) Free() int {}

// Used returns the count of IP addresses used in the range.
func (r *Range) Used() int {}

// CIDR returns the CIDR covered by the range.
func (r *Range) CIDR() net.IPNet {}

// DryRun returns a non-persisting form of this Range.
func (r *Range) DryRun() Interface {}

const dryRunTrue

const dryRunFalse

// Allocate attempts to reserve the provided IP. ErrNotInRange or
// ErrAllocated will be returned if the IP is not valid for this range
// or has already been reserved.  ErrFull will be returned if there
// are no addresses left.
func (r *Range) Allocate(ip net.IP) error {}

func (r *Range) allocate(ip net.IP, dryRun bool) error {}

// AllocateNext reserves one of the IPs from the pool. ErrFull may
// be returned if there are no addresses left.
func (r *Range) AllocateNext() (net.IP, error) {}

func (r *Range) allocateNext(dryRun bool) (net.IP, error) {}

// Release releases the IP back to the pool. Releasing an
// unallocated IP or an IP out of the range is a no-op and
// returns no error.
func (r *Range) Release(ip net.IP) error {}

func (r *Range) release(ip net.IP, dryRun bool) error {}

// ForEach calls the provided function for each allocated IP.
func (r *Range) ForEach(fn func(net.IP)) {}

// Has returns true if the provided IP is already allocated and a call
// to Allocate(ip) would fail with ErrAllocated.
func (r *Range) Has(ip net.IP) bool {}

// IPFamily returns the IP family of this range.
func (r *Range) IPFamily() api.IPFamily {}

// Snapshot saves the current state of the pool.
func (r *Range) Snapshot(dst *api.RangeAllocation) error {}

// Restore restores the pool to the previously captured state. ErrMismatchedNetwork
// is returned if the provided IPNet range doesn't exactly match the previous range.
func (r *Range) Restore(net *net.IPNet, data []byte) error {}

// contains returns true and the offset if the ip is in the range, and false
// and nil otherwise. The first and last addresses of the CIDR are omitted.
func (r *Range) contains(ip net.IP) (bool, int) {}

// Destroy shuts down internal allocator.
func (r *Range) Destroy() {}

// EnableMetrics enables metrics recording.
func (r *Range) EnableMetrics() {}

// calculateIPOffset calculates the integer offset of ip from base such that
// base + offset = ip. It requires ip >= base.
func calculateIPOffset(base *big.Int, ip net.IP) int {}

// calculateRangeOffset estimates the offset used on the range for statically allocation based on
// the following formula `min(max($min, cidrSize/$step), $max)`, described as ~never less than
// $min or more than $max, with a graduated step function between them~. The function returns 0
// if any of the parameters is invalid.
func calculateRangeOffset(cidr *net.IPNet) int {}

type dryRunRange

func (dry dryRunRange) Allocate(ip net.IP) error {}

func (dry dryRunRange) AllocateNext() (net.IP, error) {}

func (dry dryRunRange) Release(ip net.IP) error {}

func (dry dryRunRange) ForEach(cb func(net.IP)) {}

func (dry dryRunRange) CIDR() net.IPNet {}

func (dry dryRunRange) IPFamily() api.IPFamily {}

func (dry dryRunRange) DryRun() Interface {}

func (dry dryRunRange) Has(ip net.IP) bool {}

func (dry dryRunRange) Destroy() {}

func (dry dryRunRange) EnableMetrics() {}