Skip to main content

ReviewStore

Trait ReviewStore 

Source
pub trait ReviewStore {
    // Required methods
    fn save_plan(&self, hash: &str, json: &str) -> Result<(), EngineError>;
    fn load_state(&self) -> Result<ReviewState, EngineError>;
    fn save_state(&self, state: &ReviewState) -> Result<(), EngineError>;
    fn load_findings(&self) -> Result<Vec<Finding>, EngineError>;
    fn save_findings(&self, findings: &[Finding]) -> Result<(), EngineError>;
    fn load_threads(&self) -> Result<Vec<RemoteThread>, EngineError>;
    fn save_threads(&self, threads: &[RemoteThread]) -> Result<(), EngineError>;
}
Expand description

One review’s sidecar (ADR 0013).

Every read is total: a store that has never been written yields defaults, never an error. ReviewSession is write-through — every mutator saves before returning — so an implementation must be cheap enough for that, and crash-safe in the sense that matters here: a torn write loses at most the last action.

Required Methods§

Source

fn save_plan(&self, hash: &str, json: &str) -> Result<(), EngineError>

Persist a plan document under its content hash and point current at it. Idempotent: re-saving the same hash must not rewrite the body.

Takes serialised JSON and the hash rather than a PlanDocument, which keeps schema out of this module entirely — the frozen contract stays frozen (ADR 0008, 0018).

Source

fn load_state(&self) -> Result<ReviewState, EngineError>

Source

fn save_state(&self, state: &ReviewState) -> Result<(), EngineError>

Source

fn load_findings(&self) -> Result<Vec<Finding>, EngineError>

Source

fn save_findings(&self, findings: &[Finding]) -> Result<(), EngineError>

Rewrites the whole set (status changes, deletions, re-anchor results). The set is small; simplicity beats cleverness.

Source

fn load_threads(&self) -> Result<Vec<RemoteThread>, EngineError>

The forge’s threads as last fetched. A cache: every fetch replaces it, and a failed fetch leaves it as it was (ADR 0029).

Source

fn save_threads(&self, threads: &[RemoteThread]) -> Result<(), EngineError>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§