pub struct SqlJournal { /* private fields */ }Implementations§
Source§impl SqlJournal
impl SqlJournal
Sourcepub async fn connect(cfg: SqlConfig) -> Result<Arc<Self>, JournalError>
pub async fn connect(cfg: SqlConfig) -> Result<Arc<Self>, JournalError>
Connect, install drivers, and optionally run migrations.
Sourcepub async fn from_pool(
pool: AnyPool,
cfg: SqlConfig,
) -> Result<Arc<Self>, JournalError>
pub async fn from_pool( pool: AnyPool, cfg: SqlConfig, ) -> Result<Arc<Self>, JournalError>
Reuse an existing pool (for tests or app-wide sharing).
Sourcepub async fn with_worm(
self: Arc<Self>,
worm: WormConfig,
) -> Result<Arc<Self>, JournalError>
pub async fn with_worm( self: Arc<Self>, worm: WormConfig, ) -> Result<Arc<Self>, JournalError>
Turn on WORM protections (FR-9).
When deny_update_delete is set, this installs the dialect’s
append-only DDL immediately. When hash_chain is set, subsequent
writes maintain the per-pid tamper-evident hash chain. Consumes the
(typically freshly-built) journal and returns a reconfigured Arc.
pub fn pool(&self) -> &AnyPool
pub fn config(&self) -> &SqlConfig
pub fn worm_config(&self) -> WormConfig
Sourcepub async fn replay_as_of(
&self,
pid: &str,
system_time_nanos: i64,
) -> Result<Vec<PersistentRepr>, JournalError>
pub async fn replay_as_of( &self, pid: &str, system_time_nanos: i64, ) -> Result<Vec<PersistentRepr>, JournalError>
FR-8 — system-time as-of: rows recorded at or before
system_time_nanos. system_time falls back to created_at for rows
written before the column existed. Later-recorded restatements (whose
system_time is greater) are excluded → no lookahead.
Sourcepub async fn replay_valid_as_of(
&self,
pid: &str,
valid_time_nanos: i64,
system_time_nanos: i64,
) -> Result<Vec<PersistentRepr>, JournalError>
pub async fn replay_valid_as_of( &self, pid: &str, valid_time_nanos: i64, system_time_nanos: i64, ) -> Result<Vec<PersistentRepr>, JournalError>
FR-8 — bitemporal slice: rows whose valid_time is at or before
valid_time_nanos, restricted to what was known to the system at
system_time_nanos. Rows without a valid_time are treated as valid
from their system_time (always-valid) so they remain visible.
Trait Implementations§
Source§impl IntegrityVerify for SqlJournal
impl IntegrityVerify for SqlJournal
fn verify_chain<'life0, 'life1, 'async_trait>(
&'life0 self,
pid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ChainProof, IntegrityError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl Journal for SqlJournal
impl Journal for SqlJournal
fn write_messages<'life0, 'async_trait>(
&'life0 self,
messages: Vec<PersistentRepr>,
) -> Pin<Box<dyn Future<Output = Result<(), JournalError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_messages_to<'life0, 'life1, 'async_trait>(
&'life0 self,
persistence_id: &'life1 str,
to_sequence_nr: u64,
) -> Pin<Box<dyn Future<Output = Result<(), JournalError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn replay_messages<'life0, 'life1, 'async_trait>(
&'life0 self,
persistence_id: &'life1 str,
from: u64,
to: u64,
max: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<PersistentRepr>, JournalError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn highest_sequence_nr<'life0, 'life1, 'async_trait>(
&'life0 self,
persistence_id: &'life1 str,
_from_sequence_nr: u64,
) -> Pin<Box<dyn Future<Output = Result<u64, JournalError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn events_by_tag<'life0, 'life1, 'async_trait>(
&'life0 self,
tag: &'life1 str,
from_offset: u64,
max: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<PersistentRepr>, JournalError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn all_persistence_ids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, JournalError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn all_persistence_ids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, JournalError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Auto Trait Implementations§
impl Freeze for SqlJournal
impl !RefUnwindSafe for SqlJournal
impl Send for SqlJournal
impl Sync for SqlJournal
impl Unpin for SqlJournal
impl UnsafeUnpin for SqlJournal
impl !UnwindSafe for SqlJournal
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