Skip to main content

Module injected

Module injected 

Source
Expand description

Native injected mounts for a per-sandbox VFS namespace (FS-D, #365).

FS-C built the injected mounts (/stream, models, deltas) as wasm-only Mount impls (e.g. hyprstream-rpc-std’s stream_mount.rs, gated #![cfg(target_arch = "wasm32")]). Those rely on unsafe impl Send/Sync over RefCell because the browser side is single-threaded. They cannot be served to a Cloud Hypervisor guest: FS-A’s hyprstream-vfs-server runs the down-adapter on real OS threads and requires genuinely Send + Sync mounts.

This module is the native port of those injected mounts:

  • SyntheticMount — a read-only synthetic file tree built from in-memory directory/file nodes. The native counterpart of the wasm SyntheticTree, used for the models / deltas listings injected into the sandbox (e.g. /models/<id>/info, /deltas/<id>/meta). Read-only by construction: a plain Mount (not an FsMount), so the down-adapter treats writes as EROFS — fail-closed.
  • StreamMount — the native /stream pipe mount. Streams appear as /stream/{topic}/{data,info,ctl}; data yields queued blocks (EOF on an empty read), info is JSON metadata, ctl accepts cancel. The registry (StreamRegistry) is Mutex-guarded — genuinely Send + Sync, no wasm unsafe impl. The block source is decoupled behind StreamRegistry’s push/complete API so the worker runtime can feed it from any transport.

Every op threads the caller Subject — the same uniform Subject-per-call boundary the rest of the VFS enforces. A sandbox’s injected mounts live in that sandbox’s forked Namespace only, so tenant isolation is structural (#365): there is no shared registry across sandboxes unless the caller deliberately clones the Arc.

Structs§

StreamMount
Native /stream mount: streaming data pipes as a 9P-shaped tree.
StreamRegistry
Registry of active streams for a single sandbox’s /stream mount.
SyntheticMount
A read-only synthetic filesystem mount (native).

Enums§

SyntheticNode
A node in a SyntheticMount tree: either a directory of named children or a file with fixed byte contents.