Skip to main content

TranscriptSink

Trait TranscriptSink 

Source
pub trait TranscriptSink: Send {
    // Required methods
    fn record(&mut self, at: DateTime<Utc>, fact: &StepFact) -> Result<()>;
    fn finalize(&mut self) -> Result<TranscriptFingerprint>;
}
Expand description

Synchronous, durable observer of StepFacts.

Implementations must record each fact, including syncing it to the underlying storage where applicable, before returning. The executor relies on this to maintain the invariant that the UI never sees a fact that has not been durably persisted.

Required Methods§

Source

fn record(&mut self, at: DateTime<Utc>, fact: &StepFact) -> Result<()>

Record a single fact, stamped with the caller-supplied event time at. Must persist before returning, the file-backed implementation calls sync_data so a power loss after record returns cannot drop the fact.

at is supplied by the executor (the clock owner), not read here, so the recorded time is independent of the persistence implementation and the sink stays a deterministic serializer.

§Errors

Returns the underlying I/O error if the sink cannot persist the fact.

Source

fn finalize(&mut self) -> Result<TranscriptFingerprint>

Finalize the transcript and return its fingerprint.

Calling finalize more than once is implementation-defined; the default expectation is that the second call returns the cached fingerprint.

§Errors

Returns the underlying I/O error if any pending state cannot be persisted.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§