Locus
Mounts
Mounts in Locus — compose multiple drives, namespace mounts, and per-mount overlay rules.
Purpose
File and directory model with metadata, mounts, streams, watchers, journals, permission modes, and governance.
This page follows the real source shape for Locus and explains the workflow a developer is likely to use first.
Developer workflow
Start from the smallest constructor or builder, perform one meaningful operation, inspect the returned state, then add the relevant policy, storage, or network integration. The examples below should be expanded whenever the crate API changes.
Note
A mount inherits the policy and governance of its underlying drive. Mounting a drive at a new path does not re-scope permissions; the writer DIDs and threshold from the source drive still apply.
Primary types to know
AllowAllLocusPolicy— models/locus/src/policy.rsCreateOptions— models/locus/src/ops.rsFileEntry— models/locus/src/entry.rsFileMetadata— models/locus/src/entry.rsJournalRecord— models/locus/src/journal.rsJournalStore— models/locus/src/journal.rsLocus— models/locus/src/locus.rsLocusConfig— models/locus/src/config.rsMountOptions— models/locus/src/config.rsMountPoint— models/locus/src/mount.rsMountTable— models/locus/src/mount.rsOpenOptions— models/locus/src/ops.rs
Example shape
use locus::{MountOptions, MountTable};
use locus::mount::MountSource;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// The MountTable lives inside each Locus and tracks mounted external
// file systems or other Locus instances. The table is cheap to clone — it
// wraps an Arc<RwLock<HashMap<...>>> internally.
let table = MountTable::new();
// Mount another Locus identity read-only at /shared and an external store at /tmp.
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(())
}