pub struct EnvironmentLogWriter { /* private fields */ }Expand description
LogWriter implementation backed by the live LogManager.
Each write_entry call:
- Resolves the
entry_typebyte to aLogEntryType. - Writes the payload to the local log via
LogManager::log(). - Registers the returned LSN in the provided
vlsn_indexso that the VLSN→LSN mapping is kept up-to-date on the replica.
Implementations§
Source§impl EnvironmentLogWriter
impl EnvironmentLogWriter
Sourcepub fn new(log_manager: Arc<LogManager>, vlsn_index: Arc<VlsnIndex>) -> Self
pub fn new(log_manager: Arc<LogManager>, vlsn_index: Arc<VlsnIndex>) -> Self
Create a new EnvironmentLogWriter.
§Arguments
log_manager— The liveLogManagerfor this replica environment.vlsn_index— The VLSN index to update after each written entry.
Sourcepub fn with_replay(
log_manager: Arc<LogManager>,
vlsn_index: Arc<VlsnIndex>,
replay: ReplicaReplay,
) -> Self
pub fn with_replay( log_manager: Arc<LogManager>, vlsn_index: Arc<VlsnIndex>, replay: ReplicaReplay, ) -> Self
REP-7 (B): create a writer that ALSO live-applies each entry to the
replica’s in-memory tree via replay, so reads on the replica see
replicated data without a restart.
Sourcepub fn last_applied_vlsn_handle(&self) -> Option<Arc<AtomicU64>>
pub fn last_applied_vlsn_handle(&self) -> Option<Arc<AtomicU64>>
REP-10 seam: shared handle to the replica’s last-applied VLSN, when a live replay driver is installed. A future consistency policy gates reads on this; this method only exposes it.
Trait Implementations§
Source§impl LogWriter for EnvironmentLogWriter
impl LogWriter for EnvironmentLogWriter
Source§fn write_entry(
&mut self,
vlsn: u64,
entry_type: u8,
payload: &[u8],
) -> Result<()>
fn write_entry( &mut self, vlsn: u64, entry_type: u8, payload: &[u8], ) -> Result<()>
Write one replicated entry to the local log.
Resolves entry_type → LogEntryType, appends the payload to the
WAL, and records the assigned LSN in the VLSN index. Returns an
error if the entry type is unknown or the write fails.
Auto Trait Implementations§
impl !RefUnwindSafe for EnvironmentLogWriter
impl !UnwindSafe for EnvironmentLogWriter
impl Freeze for EnvironmentLogWriter
impl Send for EnvironmentLogWriter
impl Sync for EnvironmentLogWriter
impl Unpin for EnvironmentLogWriter
impl UnsafeUnpin for EnvironmentLogWriter
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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