pub struct TransactionJournal { /* private fields */ }Expand description
Transaction Journal Manager
Implementations§
Source§impl TransactionJournal
impl TransactionJournal
Sourcepub fn with_max_entries(self, max: usize) -> Self
pub fn with_max_entries(self, max: usize) -> Self
Configure maximum entries
Sourcepub fn with_max_size(self, max: usize) -> Self
pub fn with_max_size(self, max: usize) -> Self
Configure maximum size
Sourcepub fn set_enabled(&mut self, enabled: bool)
pub fn set_enabled(&mut self, enabled: bool)
Enable or disable journaling
Sourcepub async fn entries_in_window(
&self,
from: DateTime<Utc>,
to: DateTime<Utc>,
) -> Vec<(Uuid, JournalEntry)>
pub async fn entries_in_window( &self, from: DateTime<Utc>, to: DateTime<Utc>, ) -> Vec<(Uuid, JournalEntry)>
Collect every journal entry across every active transaction
whose timestamp falls within the inclusive window
[from, to]. Results are sorted in timestamp order so the
caller can replay them chronologically regardless of which
transaction they came from.
Used by the time-travel replay engine (src/replay/) to
reconstruct “what happened at the source between these two
timestamps” against a staging target.
Sourcepub async fn begin_transaction(
&self,
tx_id: Uuid,
session_id: Uuid,
node_id: NodeId,
start_lsn: u64,
) -> Result<()>
pub async fn begin_transaction( &self, tx_id: Uuid, session_id: Uuid, node_id: NodeId, start_lsn: u64, ) -> Result<()>
Start journaling a transaction
Sourcepub async fn log_statement(
&self,
tx_id: Uuid,
statement: String,
parameters: Vec<JournalValue>,
result_checksum: Option<u64>,
rows_affected: Option<u64>,
duration_ms: u64,
) -> Result<()>
pub async fn log_statement( &self, tx_id: Uuid, statement: String, parameters: Vec<JournalValue>, result_checksum: Option<u64>, rows_affected: Option<u64>, duration_ms: u64, ) -> Result<()>
Log a statement
Sourcepub async fn create_savepoint(&self, tx_id: Uuid, name: String) -> Result<()>
pub async fn create_savepoint(&self, tx_id: Uuid, name: String) -> Result<()>
Create a savepoint
Sourcepub async fn rollback_to_savepoint(&self, tx_id: Uuid, name: &str) -> Result<()>
pub async fn rollback_to_savepoint(&self, tx_id: Uuid, name: &str) -> Result<()>
Rollback to savepoint
Sourcepub async fn commit_transaction(&self, tx_id: Uuid) -> Result<()>
pub async fn commit_transaction(&self, tx_id: Uuid) -> Result<()>
Commit transaction (clear journal)
Sourcepub async fn rollback_transaction(&self, tx_id: Uuid) -> Result<()>
pub async fn rollback_transaction(&self, tx_id: Uuid) -> Result<()>
Rollback transaction (clear journal)
Sourcepub async fn get_journal(&self, tx_id: &Uuid) -> Option<TransactionJournalEntry>
pub async fn get_journal(&self, tx_id: &Uuid) -> Option<TransactionJournalEntry>
Get journal for a transaction (for replay)
Sourcepub async fn active_count(&self) -> usize
pub async fn active_count(&self) -> usize
Get active transaction count
Sourcepub async fn stats(&self) -> JournalStats
pub async fn stats(&self) -> JournalStats
Get statistics
Sourcepub async fn get_all_active(&self) -> Vec<TransactionJournalEntry>
pub async fn get_all_active(&self) -> Vec<TransactionJournalEntry>
Get all active transaction journals (for failover replay)
Sourcepub async fn get_max_start_lsn(&self) -> Option<u64>
pub async fn get_max_start_lsn(&self) -> Option<u64>
Get the maximum start LSN across all active transactions Used to determine how far the standby needs to catch up
Sourcepub async fn get_transactions_for_node(
&self,
node_id: NodeId,
) -> Vec<TransactionJournalEntry>
pub async fn get_transactions_for_node( &self, node_id: NodeId, ) -> Vec<TransactionJournalEntry>
Get transactions that started on a specific node Useful for replaying only transactions affected by a node failure
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TransactionJournal
impl !RefUnwindSafe for TransactionJournal
impl Send for TransactionJournal
impl Sync for TransactionJournal
impl Unpin for TransactionJournal
impl UnsafeUnpin for TransactionJournal
impl !UnwindSafe for TransactionJournal
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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