pub struct VirtioNetworkRuntime { /* private fields */ }Expand description
Running host-side virtio-net runtime for one guest NIC.
Ownership model:
- one runtime instance corresponds to one guest virtio NIC
- it owns the queue set shared by the worker threads
- it owns the libkrun Unix-stream bridge threads
- it owns the published-port listener threads
- it owns the smoltcp poll thread
Dropping the runtime is the shutdown signal. Drop marks the shared queues
as shutting down, wakes blocked workers, and joins the poll thread.
Implementations§
Source§impl VirtioNetworkRuntime
impl VirtioNetworkRuntime
Sourcepub fn egress_bytes(&self) -> u64
pub fn egress_bytes(&self) -> u64
Cumulative guest-outbound (egress) bytes on this NIC since boot, at the ethernet-frame level. The launcher polls this to surface per-machine egress to the node API for billing. TSI VMs have no virtio runtime, so egress is unavailable for them (a documented metering gap).
Sourcepub fn egress_counter(&self) -> Arc<AtomicU64>
pub fn egress_counter(&self) -> Arc<AtomicU64>
A cheap, cloneable read handle to this NIC’s egress counter, so the
launcher can spawn a thread that periodically flushes the value to the
VM’s runtime dir for the node API to read (the runtime is not Clone).
Trait Implementations§
Source§impl Drop for VirtioNetworkRuntime
impl Drop for VirtioNetworkRuntime
Auto Trait Implementations§
impl !RefUnwindSafe for VirtioNetworkRuntime
impl !UnwindSafe for VirtioNetworkRuntime
impl Freeze for VirtioNetworkRuntime
impl Send for VirtioNetworkRuntime
impl Sync for VirtioNetworkRuntime
impl Unpin for VirtioNetworkRuntime
impl UnsafeUnpin for VirtioNetworkRuntime
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