Skip to main content

LoopRecorder

Trait LoopRecorder 

Source
pub trait LoopRecorder: Send + Sync {
    // Required method
    fn record(&self, event: &LoopEvent) -> Result<()>;

    // Provided methods
    fn external_intent(&self, _key: &str, _intent: &Value) -> Result<()> { ... }
    fn external_result(&self, _key: &str, _result: &Value) -> Result<()> { ... }
    fn record_artifact(
        &self,
        content: &[u8],
        _media_type: &str,
    ) -> Result<String> { ... }
    fn fetch_artifact(&self, _handle: &str) -> Result<Option<Vec<u8>>> { ... }
}
Expand description

Synchronous write-ahead event sink. Implementations must durably append before returning; the loop records observations before inspecting them.

Required Methods§

Source

fn record(&self, event: &LoopEvent) -> Result<()>

Provided Methods§

Source

fn external_intent(&self, _key: &str, _intent: &Value) -> Result<()>

Write-ahead bracketing for durable external effects (system 13): the intent is recorded before the effect runs and the result after, so an interrupted run shows the open bracket. Defaults are no-ops for in-memory conformance fixtures.

Source

fn external_result(&self, _key: &str, _result: &Value) -> Result<()>

Source

fn record_artifact(&self, content: &[u8], _media_type: &str) -> Result<String>

Persist exact observation bytes and return their content handle. The default supports in-memory conformance fixtures; production recorders override it with durable content-addressed storage.

Source

fn fetch_artifact(&self, _handle: &str) -> Result<Option<Vec<u8>>>

Retrieve previously recorded artifact bytes by content handle. The default supports in-memory conformance fixtures, which never store.

Implementors§