Skip to main content

StudyCatalog

Trait StudyCatalog 

pub trait StudyCatalog: Send + Sync {
    // Required methods
    fn create_if_empty(&self, cfg: StudyConfig) -> Result<StudyCreateOutcome>;
    fn list_studies(&self) -> Result<Vec<StudySummary>>;
    fn find_by_name(&self, name: &str) -> Result<StudyLoadOutcome>;

    // Provided method
    fn list(&self) -> Result<Vec<StudySummary>> { ... }
}
Expand description

Optional storage capability for stable study identity queries.

This capability is deliberately separate from Storage. The base storage seam remains a multi-study CRUD interface and keeps its historical behavior; a backend opts into this trait only when it can provide the catalog operations as one coherent identity boundary. Callers must obtain it through Storage::study_catalog and treat None as unsupported rather than guessing conventional numeric study ids.

Required Methods§

fn create_if_empty(&self, cfg: StudyConfig) -> Result<StudyCreateOutcome>

Atomically creates cfg only when the catalog has no studies.

The empty check and insertion are one operation. Occupied leaves the catalog unchanged, including the candidate configuration. Backend failures remain Err; they are never represented as an outcome.

§Errors

Returns a backend-specific error if the catalog cannot inspect or create the study.

fn list_studies(&self) -> Result<Vec<StudySummary>>

Lists study identities in deterministic ascending StudyId order.

§Errors

Returns a backend-specific error if the catalog cannot be read.

fn find_by_name(&self, name: &str) -> Result<StudyLoadOutcome>

Resolves an exact name without selecting arbitrarily among duplicates.

NotFound and Conflict are normal typed outcomes. Backend failures remain Err.

§Errors

Returns a backend-specific error if the catalog cannot be read.

Provided Methods§

fn list(&self) -> Result<Vec<StudySummary>>

Short alias for list_studies.

§Errors

Returns the error from list_studies.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§