pub struct RestorePool { /* private fields */ }kvm only.Expand description
Pool of empty VM shells optimized for snapshot restoration.
Unlike crate::pool::VmPool, this pool does not keep fully booted guests.
Instead, it keeps KVM VM shells with memory and vCPU structures allocated so
snapshot state can be restored with less setup latency.
Implementations§
Source§impl RestorePool
impl RestorePool
Sourcepub fn new(
base_config: SandboxConfig,
config: MicrovmConfig,
pool_config: RestorePoolConfig,
) -> Result<Self, RestorePoolError>
Available on Linux only.
pub fn new( base_config: SandboxConfig, config: MicrovmConfig, pool_config: RestorePoolConfig, ) -> Result<Self, RestorePoolError>
Creates a pool of empty VM shells for snapshot restore.
The pool validates capacity limits and microVM assets, then warms the configured minimum number of empty slots.
Sourcepub fn restore(
&self,
memory: &[u8],
vcpu_state: &[u8],
) -> Result<PooledRestoreVm, RestorePoolError>
Available on Linux only.
pub fn restore( &self, memory: &[u8], vcpu_state: &[u8], ) -> Result<PooledRestoreVm, RestorePoolError>
Restores a microVM from guest memory pages and serialized vCPU state.
A pre-created slot is used when available; otherwise the pool creates one on demand and rolls back accounting if restoration fails.
Sourcepub fn restore_from_bytes(
&self,
data: &[u8],
) -> Result<PooledRestoreVm, RestorePoolError>
Available on Linux only.
pub fn restore_from_bytes( &self, data: &[u8], ) -> Result<PooledRestoreVm, RestorePoolError>
Restores a microVM from full self-describing snapshot bytes.
Sourcepub fn restore_snapshot(
&self,
snapshot: &SandboxSnapshot,
) -> Result<PooledRestoreVm, RestorePoolError>
Available on Linux only.
pub fn restore_snapshot( &self, snapshot: &SandboxSnapshot, ) -> Result<PooledRestoreVm, RestorePoolError>
Restores a microVM from a SandboxSnapshot.
File-backed snapshots use the optimized file path when the build supports it; otherwise the snapshot is loaded into memory before restoration.
Sourcepub fn idle_count(&self) -> usize
Available on Linux only.
pub fn idle_count(&self) -> usize
Returns the current number of idle slots in the restore pool.
If the internal lock is poisoned, this method logs the condition and returns
0 rather than panicking.
Sourcepub fn warm(&self, target: usize) -> Result<(), RestorePoolError>
Available on Linux only.
pub fn warm(&self, target: usize) -> Result<(), RestorePoolError>
Warms the restore pool to at least target empty VM shells.
The effective target is capped by RestorePoolConfig::max_size.
Trait Implementations§
Source§impl Clone for RestorePool
Available on Linux only.
impl Clone for RestorePool
Source§fn clone(&self) -> RestorePool
fn clone(&self) -> RestorePool
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more