pub struct RedbMarkerBackend { /* private fields */ }Expand description
On-disk MarkerBackend backed by a per-run [redb] marker sidecar file.
The caller supplies the full file path, normally
<base>/<instance_id>/<run_id>.markers.redb. The backend creates the parent directory on
first open, stores every durable record with its precomputed 32-byte integrity hash, and
commits each mutation with [Durability::Immediate]. Reopening an unsealed marker file seals
it as RunStatus::CrashedRecovered and returns Ok(()), because marker files never block
trader boot.
Implementations§
Source§impl RedbMarkerBackend
impl RedbMarkerBackend
Sourcepub fn new(file_path: impl Into<PathBuf>) -> Self
pub fn new(file_path: impl Into<PathBuf>) -> Self
Creates a backend for the supplied marker sidecar file path.
Sourcepub fn current_path(&self) -> Result<&Path, EventStoreError>
pub fn current_path(&self) -> Result<&Path, EventStoreError>
Returns the path of the currently open marker file.
§Errors
Returns EventStoreError::Backend when no run is open.
Sourcepub fn open_read_only_file(
path: impl Into<PathBuf>,
) -> Result<Self, EventStoreError>
pub fn open_read_only_file( path: impl Into<PathBuf>, ) -> Result<Self, EventStoreError>
Opens an existing marker sidecar file read-only for verification.
Marker verification must not seal, recover, or otherwise mutate the sidecar it scans. This constructor accepts any manifest status and leaves lifecycle policy to the caller’s report.
§Errors
Returns EventStoreError::Backend when the marker file is missing, and
EventStoreError::Corrupted when the file lacks a marker manifest or fails to decode.
Trait Implementations§
Source§impl Debug for RedbMarkerBackend
impl Debug for RedbMarkerBackend
Source§impl MarkerBackend for RedbMarkerBackend
impl MarkerBackend for RedbMarkerBackend
Source§fn open_run(&mut self, manifest: MarkerManifest) -> Result<(), EventStoreError>
fn open_run(&mut self, manifest: MarkerManifest) -> Result<(), EventStoreError>
Source§fn append_snapshot(
&mut self,
snapshot: &DataCursorSnapshot,
hash: [u8; 32],
) -> Result<(), EventStoreError>
fn append_snapshot( &mut self, snapshot: &DataCursorSnapshot, hash: [u8; 32], ) -> Result<(), EventStoreError>
Source§fn append_hifi(
&mut self,
marker: &HiFiMarker,
hash: [u8; 32],
) -> Result<(), EventStoreError>
fn append_hifi( &mut self, marker: &HiFiMarker, hash: [u8; 32], ) -> Result<(), EventStoreError>
Source§fn append_gap(
&mut self,
gap: &MarkerGap,
hash: [u8; 32],
) -> Result<(), EventStoreError>
fn append_gap( &mut self, gap: &MarkerGap, hash: [u8; 32], ) -> Result<(), EventStoreError>
Source§fn put_dict(
&mut self,
entry: &StreamDictEntry,
hash: [u8; 32],
) -> Result<(), EventStoreError>
fn put_dict( &mut self, entry: &StreamDictEntry, hash: [u8; 32], ) -> Result<(), EventStoreError>
Source§fn scan_snapshots(&self) -> Result<Vec<DataCursorSnapshot>, EventStoreError>
fn scan_snapshots(&self) -> Result<Vec<DataCursorSnapshot>, EventStoreError>
marker_seq order. Read moreSource§fn scan_snapshot_records(
&self,
) -> Result<Option<Vec<StoredMarkerRecord<DataCursorSnapshot>>>, EventStoreError>
fn scan_snapshot_records( &self, ) -> Result<Option<Vec<StoredMarkerRecord<DataCursorSnapshot>>>, EventStoreError>
Source§fn scan_hifi(&self) -> Result<Vec<HiFiMarker>, EventStoreError>
fn scan_hifi(&self) -> Result<Vec<HiFiMarker>, EventStoreError>
marker_seq order. Read moreSource§fn scan_hifi_records(
&self,
) -> Result<Option<Vec<StoredMarkerRecord<HiFiMarker>>>, EventStoreError>
fn scan_hifi_records( &self, ) -> Result<Option<Vec<StoredMarkerRecord<HiFiMarker>>>, EventStoreError>
Source§fn scan_gaps(&self) -> Result<Vec<MarkerGap>, EventStoreError>
fn scan_gaps(&self) -> Result<Vec<MarkerGap>, EventStoreError>
from_marker_seq order. Read moreSource§fn scan_gap_records(
&self,
) -> Result<Option<Vec<StoredMarkerRecord<MarkerGap>>>, EventStoreError>
fn scan_gap_records( &self, ) -> Result<Option<Vec<StoredMarkerRecord<MarkerGap>>>, EventStoreError>
Source§fn scan_dict(&self) -> Result<Vec<StreamDictEntry>, EventStoreError>
fn scan_dict(&self) -> Result<Vec<StreamDictEntry>, EventStoreError>
Source§fn scan_dict_records(
&self,
) -> Result<Option<Vec<StoredMarkerRecord<StreamDictEntry>>>, EventStoreError>
fn scan_dict_records( &self, ) -> Result<Option<Vec<StoredMarkerRecord<StreamDictEntry>>>, EventStoreError>
Source§fn seal(&mut self, status: RunStatus) -> Result<(), EventStoreError>
fn seal(&mut self, status: RunStatus) -> Result<(), EventStoreError>
Source§fn manifest(&self) -> Result<MarkerManifest, EventStoreError>
fn manifest(&self) -> Result<MarkerManifest, EventStoreError>
Auto Trait Implementations§
impl !RefUnwindSafe for RedbMarkerBackend
impl !UnwindSafe for RedbMarkerBackend
impl Freeze for RedbMarkerBackend
impl Send for RedbMarkerBackend
impl Sync for RedbMarkerBackend
impl Unpin for RedbMarkerBackend
impl UnsafeUnpin for RedbMarkerBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more