pub struct IpamAllocator { /* private fields */ }Expand description
Bitmap-based IP address allocator for a single subnet.
Implementations§
Source§impl IpamAllocator
impl IpamAllocator
Sourcepub fn new(config: &IpamConfig) -> Self
pub fn new(config: &IpamConfig) -> Self
Create a new IPAM allocator from config.
Sourcepub fn allocate(&mut self) -> Result<u32, IpamError>
pub fn allocate(&mut self) -> Result<u32, IpamError>
Allocate the next available IP address.
Returns the full IP address.
Sourcepub fn is_allocated(&self, ip: u32) -> bool
pub fn is_allocated(&self, ip: u32) -> bool
Check if an IP address is currently allocated.
Sourcepub fn available_count(&self) -> u32
pub fn available_count(&self) -> u32
Get the number of available addresses.
Sourcepub fn allocated_count(&self) -> u32
pub fn allocated_count(&self) -> u32
Get the number of allocated addresses.
Sourcepub fn total_addresses(&self) -> u32
pub fn total_addresses(&self) -> u32
Get the total number of allocatable addresses.
Sourcepub fn status_string(&self) -> String
pub fn status_string(&self) -> String
Format the allocator status as a string.