Locus
Mounts
Standalone mount metadata and its boundary with the current Locus API.
MountTable stores mount descriptions and resolves a path to a matching description. Calling mount records metadata; it does not mount a host filesystem, open a remote drive or authenticate the listed identity. The table created below is independent of the private table inside Locus; current public Locus methods do not expose attaching it. Read-only mount options alone do not install a backend or ACL.
This example is checked against source signatures; it was not compiled or run during this documentation pass.
use locus::{MountOptions, MountTable};
use locus::mount::MountSource;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a standalone table of mount descriptions.
let table = MountTable::new();
// Record descriptions only; no remote or external filesystem is opened.
let ro = MountOptions { read_only: true, ..MountOptions::default() };
table.mount(
"/shared".into(),
Some(MountSource::Locus { identity: "did:l1fe:peer".into() }),
ro,
)?;
table.mount(
"/tmp".into(),
Some(MountSource::External {
fs_type: "tmpfs".into(),
params: serde_json::json!({ "size_mb": 64 }),
}),
MountOptions::default(),
)?;
// Lookups resolve a path to its enclosing mount; useful for write routing.
let target = table.find_mount("/shared/notes.md").map(|m| m.path);
let mounts = table.list_mounts();
println!("mounts={} target={:?}", mounts.len(), target);
table.unmount("/tmp")?;
Ok(())
}