pub struct MCardFileSystem { /* private fields */ }Expand description
The universal immutable filesystem engine mapping URIs to content-addressed MCards.
Implementations§
Source§impl MCardFileSystem
impl MCardFileSystem
Sourcepub fn write_raw_bytes(
&self,
uri: &str,
content: &[u8],
algorithm: Option<&str>,
) -> Result<MCardRecord>
pub fn write_raw_bytes( &self, uri: &str, content: &[u8], algorithm: Option<&str>, ) -> Result<MCardRecord>
Writes raw content bytes into card and binds uri in handle_registry (INV-510-01, INV-510-02).
Sourcepub fn read_raw_bytes(&self, uri: &str) -> Result<Vec<u8>>
pub fn read_raw_bytes(&self, uri: &str) -> Result<Vec<u8>>
Reads and verifies exact raw bytes bound to uri (INV-510-01).
Sourcepub fn bind(
&self,
uri: &str,
new_ref: &str,
expected_old_ref: Option<&str>,
) -> Result<bool>
pub fn bind( &self, uri: &str, new_ref: &str, expected_old_ref: Option<&str>, ) -> Result<bool>
Atomic Compare-and-Swap handle binding (INV-510-03).
Returns Ok(true) on commit, or Ok(false) when expected_old_ref mismatches the current head.
Sourcepub fn write_directory_manifest(
&self,
dir_uri: &str,
manifest: &DirectoryManifest,
) -> Result<MCardRecord>
pub fn write_directory_manifest( &self, dir_uri: &str, manifest: &DirectoryManifest, ) -> Result<MCardRecord>
Writes a DirectoryManifest MCard to dir_uri (INV-510-04).
Sourcepub fn read_directory_manifest(
&self,
dir_uri: &str,
) -> Result<DirectoryManifest>
pub fn read_directory_manifest( &self, dir_uri: &str, ) -> Result<DirectoryManifest>
Reads a DirectoryManifest MCard from dir_uri (INV-510-04).
Source§impl MCardFileSystem
impl MCardFileSystem
Sourcepub fn new_in_memory() -> Result<Self>
pub fn new_in_memory() -> Result<Self>
Initializes an isolated, zero-disk in-memory MCard filesystem (INV-09).
Sourcepub fn new_in_memory_scoped(prefix: &str) -> Result<Self>
pub fn new_in_memory_scoped(prefix: &str) -> Result<Self>
Initializes an in-memory MCard filesystem scoped to a specific context prefix.
Sourcepub fn new(conn: Arc<Mutex<Connection>>, context_prefix: &str) -> Self
pub fn new(conn: Arc<Mutex<Connection>>, context_prefix: &str) -> Self
Wraps an existing SQLite connection manager or shared connection with an optional context prefix.
Sourcepub fn with_connection(conn: Arc<Mutex<Connection>>) -> Result<Self>
pub fn with_connection(conn: Arc<Mutex<Connection>>) -> Result<Self>
Wraps an existing SQLite connection manager or shared connection (root prefix).
Sourcepub fn with_prefix(&self, prefix: &str) -> Self
pub fn with_prefix(&self, prefix: &str) -> Self
Returns a new MCardFileSystem handle sharing the same storage but isolated to prefix.
Sourcepub fn context_prefix(&self) -> &str
pub fn context_prefix(&self) -> &str
Returns the active context prefix for this filesystem handle.
Sourcepub fn canonicalize_uri(&self, path: &str) -> String
pub fn canonicalize_uri(&self, path: &str) -> String
Resolves canonical URI with context prefix scoping (DOD-191-04).
Sourcepub fn ephemeral_mount(&self, fiber: &Fiber, prefix: &str) -> Result<Self>
pub fn ephemeral_mount(&self, fiber: &Fiber, prefix: &str) -> Result<Self>
Ephemerally mounts a scoped MCardFileSystem on a Fiber, registering a LIFO unmount callback on the fiber’s DisposableList that cleans up all transient handles on disposal (DOD-191-07).
Sourcepub fn write_file(
&self,
uri: &str,
payload: MCardPayload,
author: AgentDid,
) -> Result<MCard>
pub fn write_file( &self, uri: &str, payload: MCardPayload, author: AgentDid, ) -> Result<MCard>
Writes an MCard into the filesystem, content-addressing the payload and updating the handle registry.
Sourcepub fn read_file(&self, uri: &str) -> Result<MCard>
pub fn read_file(&self, uri: &str) -> Result<MCard>
Reads and cryptographically verifies an MCard by its URI handle (INV-02, INV-04).
Sourcepub fn stat_file(&self, uri: &str) -> Result<MCardStat>
pub fn stat_file(&self, uri: &str) -> Result<MCardStat>
Returns stat metadata for a virtual file.
Sourcepub fn list_dir(&self, prefix: &str) -> Result<Vec<String>>
pub fn list_dir(&self, prefix: &str) -> Result<Vec<String>>
Lists all MCard handles sharing the specified URI prefix.
Sourcepub fn delete_file(&self, uri: &str) -> Result<()>
pub fn delete_file(&self, uri: &str) -> Result<()>
Deregisters an MCard handle, preserving the underlying immutable CAS blob (INV-04).