Commit adce75e
committed
Add SandboxBuilder
`SandboxBuilder` is the entry point for creating a sandbox. It gathers machine
configuration, host functions, init data and memory mappings, then builds a
`MultiUseSandbox` from a guest binary on disk, a guest binary in memory, or a
snapshot.
It merges the roles of `SandboxConfiguration`, `GuestEnvironment` and
`UninitializedSandbox` into a single type, so all three can become
implementation details.
Every setting has an in place accessor taking `&mut self` and a `with_*`
counterpart consuming `self` for chaining. Machine configuration values are
readable through `get_*`.
`map_memory_region` is `unsafe`, matching `MultiUseSandbox::map_region`. The
mapped region must stay valid for the lifetime of the built sandbox.
`build_from_snapshot` errors when `init_data` or `max_guest_log_level` are set,
as a snapshot already carries both.1 parent 52ba62c commit adce75e
5 files changed
Lines changed: 539 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
| |||
0 commit comments