pub struct NetBuilder { /* private fields */ }Expand description
Builder for acquiring a fabric network lease.
Allows specifying minimum bandwidth requirements.
§Examples
use grafos_std::net::NetBuilder;
let lease = NetBuilder::new().min_bandwidth(1_000_000_000).acquire()?;
assert!(lease.net().bandwidth() >= 1_000_000_000);Implementations§
Source§impl NetBuilder
impl NetBuilder
Sourcepub fn min_bandwidth(self, bps: u64) -> Self
pub fn min_bandwidth(self, bps: u64) -> Self
Set the minimum bandwidth required in bits per second.
Sourcepub fn lease_secs(self, secs: u64) -> Self
pub fn lease_secs(self, secs: u64) -> Self
Set the lease TTL in seconds.
Sourcepub fn acquire(self) -> Result<NetLease>
pub fn acquire(self) -> Result<NetLease>
Acquire a network lease.
Calls the host net_hello function with the requested minimum
bandwidth. The host allocates a NIC (macvlan or SR-IOV VF) and
returns the interface name and actual bandwidth.
§Errors
Returns FabricError::CapacityExceeded if the host cannot
satisfy the bandwidth requirement, or FabricError::Disconnected
if the host connection fails.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NetBuilder
impl RefUnwindSafe for NetBuilder
impl Send for NetBuilder
impl Sync for NetBuilder
impl Unpin for NetBuilder
impl UnwindSafe for NetBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more