Skip to main content

Module remote_registry_mount

Module remote_registry_mount 

Source
Expand description

Remote registry mount — bridges the VFS Mount trait to the registry service’s worktree filesystem via the generated WorktreeClient RPC.

RemoteRegistryMount is the registry analogue of RemoteModelMount: where RemoteModelMount proxies 9P operations to the model service’s per-modelRef synthetic tree (1 path level: first component = modelRef), this mount proxies to the registry service’s per-worktree real filesystem — 2 path levels: first = repo name, second = worktree name, the rest = in-worktree wnames. Repo names resolve to UUIDs via the registry’s get_by_name RPC.

§Shared bridge

The sync→async plumbing (embedded tokio runtime, fid allocator, fid map, anyhow → MountError mapping, the opaque fid key) is shared with RemoteModelMount via NinePBridge in crate::services::ninep_bridge. Only the registry-specific pieces live here: the RegistryClient/WorktreeClient types, the 2-level scope extraction (repo → worktree, with async get_by_name UUID resolution), the np_stat (not stat) RPC method name, and the worktree-specific directory-entry byte format (name_len+name+is_dir+size), parsed by parse_worktree_dir_entries below.

§Real qids

Now that #388 widened vfs::Stat with version + path, this mount threads the wire qid {qtype, version=ctime, path=ino} from the registry service’s RStat/RWalk responses straight through — that is the whole point of the qid-soundness work. See the invariant on hyprstream_vfs::Stat: these are advisory hints, not yet a strong identity (content-CID qid lands in #387).

§Fid management

The mount allocates local fid numbers and tracks them via the bridge’s DashMap. Each local fid maps to a RemoteFidState that stores the resolved WorktreeClient (curried with repo_id + worktree_name), the remote fid number returned by walk, plus qtype for stat/readdir synthesis.

§Timeout / graceful degradation

A dedicated single-threaded tokio runtime drives the async client. If the registry service is unreachable, block_on will hang until the ZMQ socket timeout fires (set on the underlying socket). Callers see MountError::Io("service unreachable: ...").

Structs§

RemoteRegistryMount
A Mount implementation that proxies 9P operations to the registry service’s worktree filesystem via the generated WorktreeClient RPC.