Skip to main content

BackendRegistration

Struct BackendRegistration 

Source
pub struct BackendRegistration {
    pub name: &'static str,
    pub priority: i32,
    pub auto_selectable: bool,
    pub injects_9p_socket: bool,
    pub mounts_fuse_vfs: bool,
    pub is_available: fn() -> bool,
    pub construct: fn(&BackendCtx) -> Result<Arc<dyn SandboxBackend>>,
}
Expand description

A compile-time sandbox-backend registration, collected via inventory.

Each backend submits one of these next to its implementation, gated by the #[cfg] feature that compiles the backend in. The registry is enumerated by resolve_backend; there is no central enum to keep in sync.

Fields§

§name: &'static str

Stable selector name, e.g. "kata", "nspawn". Matched against worker.backend (case-insensitively).

§priority: i32

Auto-selection precedence: higher is preferred. "auto" picks the highest-priority available registration (among auto_selectable ones).

§auto_selectable: bool

Whether this backend is eligible for "auto" selection.

true → "auto" may pick it (subject to priority and is_available). false → explicit-name-only: "auto" must never choose it, even if it is the highest-priority available (or only) registration. It remains selectable by its concrete name (fail-closed).

This exists so weaker-isolation tiers cannot become a silent "auto" fallback when stronger backends are absent — auto-selecting them would be a silent isolation downgrade, which the #547 MAC/ZSP model forbids. The in-process wasm sandbox (shared host address space) sets this false.

§injects_9p_socket: bool

Whether this backend can inject a 9P socket endpoint — a host Unix domain socket — into a workload’s mount namespace (#506).

The Wanix-guest workload (runtime::wanix_workload) works by having hyprstream serve a tenant’s Subject-scoped VFS Mount as a 9P2000.L server on a host UDS, then making that socket reachable inside the sandbox (bind-mounting the host socket into the container’s mount namespace and setting HYPRSTREAM_9P_SOCK) so the guest dials back. That requires the backend to be able to bind-mount an arbitrary host path (the socket) into the workload, which the tiers do differently:

  • oci / nspawn → true: both bind-mount host paths into the container (podman --volume / nspawn --bind), so a host UDS injects cleanly.
  • kata → false: a full VM does not share the host mount namespace, so a host UDS cannot be bind-injected the same way (the VM path uses virtio-fs, a different mechanism — see sandbox_fs); it therefore does not advertise this capability.
  • wasm → false: in-process, no separate mount namespace to inject a host socket into.

Selection is fail-closed on this flag: a workload that requires 9P socket injection (resolve_backend_9p_capable / require_9p_socket_capability) never resolves to a backend that does not advertise it — it errors rather than silently dropping the injection.

§mounts_fuse_vfs: bool

Whether this backend FUSE-mounts the composed per-sandbox tenant VFS as a real host directory and POSIX-roots its workload there (Model B, #715 — the non-VM sibling of the kata virtio-fs path).

true → the backend consumes SandboxFs::serve_local_at to serve the composed namespace over /dev/fuse and give that host directory to the container. nspawn sets this. kata does not — it already shares the composed VFS as a virtio-fs device, not a host FUSE mount. In-process wasm has no host filesystem to mount into. oci is deferred pending a rootless /dev/fuse feasibility spike and advertises false for now.

require_fuse_mount_capability gates the mount fail-closed: a backend that does not advertise this capability is never handed a FUSE-rooted namespace (no silent POSIX-rooting in a namespace a backend can’t mount).

§is_available: fn() -> bool

Runtime prerequisite probe (PATH lookups, socket existence, …). Returns true when this backend can actually run on this host right now. Used to inform "auto" and to fail-close explicit requests whose prereqs are missing.

§construct: fn(&BackendCtx) -> Result<Arc<dyn SandboxBackend>>

Construct the concrete backend from per-call BackendCtx state.

Trait Implementations§

Source§

impl Debug for BackendRegistration

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Collect for BackendRegistration

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> ServiceExt for T

§

fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>
where Self: Sized,

Apply a transformation to the response body. Read more
§

fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using HTTP status codes. Read more
§

fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using gRPC headers. Read more
§

fn follow_redirects(self) -> FollowRedirect<Self>
where Self: Sized,

Follow redirect resposes using the Standard policy. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSync for T
where T: Sync,

§

impl<T> MaybeSync for T
where T: Sync,

§

impl<T> SendSyncUnwindSafe for T
where T: Send + Sync + UnwindSafe + ?Sized,