pub struct SnapshotOptions { /* private fields */ }Expand description
Options for
Sandbox::snapshot_with_options.
The default options take the same snapshot as
Sandbox::snapshot.
Implementations§
Source§impl SnapshotOptions
impl SnapshotOptions
Sourcepub fn scratch_size(self, scratch_size: usize) -> Self
pub fn scratch_size(self, scratch_size: usize) -> Self
The snapshot, and the sandbox it is taken from, get a scratch region
of scratch_size bytes. By default the scratch size stays the same.
A sandbox can boot with the scratch its initialisation needs, then run guest function calls from a snapshot with only the scratch they need, which makes each restore cheaper, or with more scratch than it booted with.
A size larger than the maximum memory size (MemoryRequestTooBig),
too small for the transport (MemoryRequestTooSmall), or not a
whole number of host pages is rejected before the guest is entered.
Room for the page tables depends on the guest’s mappings and is
checked when the snapshot is built, after a pending transport
checkpoint has run in the guest: a size without it fails then, with
MemoryRequestTooSmall. A larger size whose scratch window would
cover a guest mapping below the current one fails then too. Both
failures leave the sandbox usable. Whether guest function calls fit
is not checked: one that needs more scratch fails in the guest, and
a later restore recovers the sandbox.