pub trait AddressAllocator<Token>: Send + Sync {
// Required methods
fn allocate(
&self,
isd_as: IsdAsn,
prefix: IpNet,
claims: Token,
) -> Result<AddressAllocation, AddressAllocationError>;
fn put_on_hold(&self, id: AddressAllocationId) -> bool;
fn deallocate(&self, id: AddressAllocationId) -> bool;
}Expand description
Address allocator trait.
Required Methods§
Sourcefn allocate(
&self,
isd_as: IsdAsn,
prefix: IpNet,
claims: Token,
) -> Result<AddressAllocation, AddressAllocationError>
fn allocate( &self, isd_as: IsdAsn, prefix: IpNet, claims: Token, ) -> Result<AddressAllocation, AddressAllocationError>
Allocate an address to a client.
-
The implementation SHOULD renew existing allocation, if the token claims matches an existing allocation and return the corresponding address.
-
The implementation MUST attempt to return a concrete address if either IPV4_WILDCARD or IPV6_WILDCARD is provided.
Sourcefn put_on_hold(&self, id: AddressAllocationId) -> bool
fn put_on_hold(&self, id: AddressAllocationId) -> bool
Sets an address on hold
The hold prevents the address from being reallocated for a certain period of time.
Sourcefn deallocate(&self, id: AddressAllocationId) -> bool
fn deallocate(&self, id: AddressAllocationId) -> bool
Immediately deallocates an address
Returns true if allocation was found and removed, false if allocation was not found