Trait MetadataStore

Source
pub trait MetadataStore {
    // Required methods
    fn get(&self, path: &str) -> Option<&String>;
    fn set(&mut self, path: &str, metadata: String);

    // Provided method
    fn remove(&mut self, path: &str) -> Option<String> { ... }
}
Expand description

Trait defining a simple key‑value metadata store.

What: Provides read, write and removal operations for associating a string of metadata with a file‑system path.

How: The trait abstracts over concrete storage implementations – currently an in‑memory HashMap – allowing callers to depend on the trait rather than a specific type.

Why: CHORUS needs a lightweight way to attach auxiliary information to files without persisting to a database; the trait makes it easy to swap in a persistent backend later if required.

Required Methods§

Source

fn get(&self, path: &str) -> Option<&String>

Retrieves the metadata for path if it exists.

Source

fn set(&mut self, path: &str, metadata: String)

Stores metadata for path, overwriting any existing value.

Provided Methods§

Source

fn remove(&mut self, path: &str) -> Option<String>

Removes the metadata entry for path, returning the old value if any.

Implementors§