Skip to main content

MarkerBackend

Trait MarkerBackend 

Source
pub trait MarkerBackend: Debug + Send {
Show 15 methods // Required methods fn open_run( &mut self, manifest: MarkerManifest, ) -> Result<(), EventStoreError>; fn append_snapshot( &mut self, snapshot: &DataCursorSnapshot, hash: [u8; 32], ) -> Result<(), EventStoreError>; fn append_hifi( &mut self, marker: &HiFiMarker, hash: [u8; 32], ) -> Result<(), EventStoreError>; fn append_gap( &mut self, gap: &MarkerGap, hash: [u8; 32], ) -> Result<(), EventStoreError>; fn put_dict( &mut self, entry: &StreamDictEntry, hash: [u8; 32], ) -> Result<(), EventStoreError>; fn scan_snapshots(&self) -> Result<Vec<DataCursorSnapshot>, EventStoreError>; fn scan_hifi(&self) -> Result<Vec<HiFiMarker>, EventStoreError>; fn scan_gaps(&self) -> Result<Vec<MarkerGap>, EventStoreError>; fn scan_dict(&self) -> Result<Vec<StreamDictEntry>, EventStoreError>; fn seal(&mut self, status: RunStatus) -> Result<(), EventStoreError>; fn manifest(&self) -> Result<MarkerManifest, EventStoreError>; // Provided methods fn scan_snapshot_records( &self, ) -> Result<Option<Vec<StoredMarkerRecord<DataCursorSnapshot>>>, EventStoreError> { ... } fn scan_hifi_records( &self, ) -> Result<Option<Vec<StoredMarkerRecord<HiFiMarker>>>, EventStoreError> { ... } fn scan_gap_records( &self, ) -> Result<Option<Vec<StoredMarkerRecord<MarkerGap>>>, EventStoreError> { ... } fn scan_dict_records( &self, ) -> Result<Option<Vec<StoredMarkerRecord<StreamDictEntry>>>, EventStoreError> { ... }
}
Expand description

A durable backend for the data marker sidecar.

Backends persist cursor snapshots, high-fidelity markers, gaps, and the slot dictionary for one open run at a time, mirroring the EventStore trait for the marker file. Each durable record is appended with its precomputed integrity hash so a verifier can recompute and detect tampering. The marker path never blocks trading, so overflow is recorded as a MarkerGap by the writer rather than failing the caller here.

Required Methods§

Source

fn open_run(&mut self, manifest: MarkerManifest) -> Result<(), EventStoreError>

Opens a run for marker capture with the supplied manifest.

The status is normalized to RunStatus::Running and the per-table counts are zeroed, so a caller can pass a freshly built or reused manifest without pre-clearing it.

§Errors

Returns EventStoreError::Backend for unclassified backend failures.

Source

fn append_snapshot( &mut self, snapshot: &DataCursorSnapshot, hash: [u8; 32], ) -> Result<(), EventStoreError>

Appends a cursor snapshot with its precomputed integrity hash.

§Errors

Returns EventStoreError::Closed when the run is sealed, and EventStoreError::Backend when no run is open or for unclassified backend failures.

Source

fn append_hifi( &mut self, marker: &HiFiMarker, hash: [u8; 32], ) -> Result<(), EventStoreError>

Appends a high-fidelity marker with its precomputed integrity hash.

§Errors

See append_snapshot.

Source

fn append_gap( &mut self, gap: &MarkerGap, hash: [u8; 32], ) -> Result<(), EventStoreError>

Appends a gap covering a dropped range of marker sequences, with its precomputed integrity hash.

§Errors

See append_snapshot.

Source

fn put_dict( &mut self, entry: &StreamDictEntry, hash: [u8; 32], ) -> Result<(), EventStoreError>

Records a slot dictionary entry with its precomputed integrity hash, write-once by slot.

A second call for an already-recorded slot is ignored, so the first observed slot -> (data_cls, identifier) mapping wins and cannot be remapped.

§Errors

See append_snapshot.

Source

fn scan_snapshots(&self) -> Result<Vec<DataCursorSnapshot>, EventStoreError>

Scans all cursor snapshots in ascending marker_seq order.

§Errors

Returns EventStoreError::Backend when no run is open or for unclassified backend failures.

Source

fn scan_hifi(&self) -> Result<Vec<HiFiMarker>, EventStoreError>

Scans all high-fidelity markers in ascending marker_seq order.

§Errors

See scan_snapshots.

Source

fn scan_gaps(&self) -> Result<Vec<MarkerGap>, EventStoreError>

Scans all recorded gaps in ascending from_marker_seq order.

§Errors

See scan_snapshots.

Source

fn scan_dict(&self) -> Result<Vec<StreamDictEntry>, EventStoreError>

Scans all slot dictionary entries in ascending slot order.

§Errors

See scan_snapshots.

Source

fn seal(&mut self, status: RunStatus) -> Result<(), EventStoreError>

Seals the open run with the given terminal status.

§Errors

Returns EventStoreError::Backend when status is RunStatus::Running or no run is open, and EventStoreError::Closed when the run is already sealed.

Source

fn manifest(&self) -> Result<MarkerManifest, EventStoreError>

Returns the current marker manifest.

§Errors

Returns EventStoreError::Backend when no run is open.

Provided Methods§

Source

fn scan_snapshot_records( &self, ) -> Result<Option<Vec<StoredMarkerRecord<DataCursorSnapshot>>>, EventStoreError>

Scans cursor snapshots with stored integrity hashes when the backend exposes them.

Returns Ok(None) for backends that can only expose decoded records.

§Errors

See scan_snapshots.

Source

fn scan_hifi_records( &self, ) -> Result<Option<Vec<StoredMarkerRecord<HiFiMarker>>>, EventStoreError>

Scans high-fidelity markers with stored integrity hashes when the backend exposes them.

Returns Ok(None) for backends that can only expose decoded records.

§Errors

See scan_hifi.

Source

fn scan_gap_records( &self, ) -> Result<Option<Vec<StoredMarkerRecord<MarkerGap>>>, EventStoreError>

Scans marker gaps with stored integrity hashes when the backend exposes them.

Returns Ok(None) for backends that can only expose decoded records.

§Errors

See scan_gaps.

Source

fn scan_dict_records( &self, ) -> Result<Option<Vec<StoredMarkerRecord<StreamDictEntry>>>, EventStoreError>

Scans dictionary entries with stored integrity hashes when the backend exposes them.

Returns Ok(None) for backends that can only expose decoded records.

§Errors

See scan_dict.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§