Documentation
¶
Index ¶
- type BitField
- func (bf *BitField) AllocateAvailableBitsInRange(start, end, n int) ([]int, error)
- func (bf *BitField) AllocateNextAvailableBits(n int) ([]int, error)
- func (bf *BitField) ClearBit(pos int)
- func (bf *BitField) IsSet(pos int) bool
- func (bf *BitField) SetBit(pos int)
- func (bf *BitField) String() string
- type PortRange
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BitField ¶
type BitField struct {
// contains filtered or unexported fields
}
BitField struct holds a slice of uint64 integers for 64-bit blocks
func NewBitField ¶
NewBitField creates a BitField capable of holding 'n' bits
func (*BitField) AllocateAvailableBitsInRange ¶
AllocateAvailableBitsInRange finds the next `n` available (unset) bits within a specified range [start, end). It does not require the bits to be consecutive.
func (*BitField) AllocateNextAvailableBits ¶
AllocateNextAvailableBits finds and sets the next `n` available bits, returning their positions. It does not require the bits to be consecutive.
type PortRange ¶
type PortRange struct {
// contains filtered or unexported fields
}
PortRange struct for managing a range of ports with a starting index and fixed size
func NewPortRange ¶
NewPortRange creates a new PortRange with a specified startPort and size
func (*PortRange) AllocateNextPorts ¶
AllocateNextPorts allocates the next `n` available ports in the range. It uses `AllocateNextAvailableBits` to find non-consecutive available ports.
func (*PortRange) IsPortAllocated ¶
IsPortAllocated checks if a specific port in the range is allocated
func (*PortRange) ReleasePorts ¶
ReleasePorts releases a specified list of ports in the range
func (*PortRange) SetPortAllocated ¶
SetPortAllocated sets a specific port in the range as allocated