pub trait Journal: Send + Sync {
// Required methods
fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 Event,
) -> Pin<Box<dyn Future<Output = Result<(), JournalError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn acquire_lease<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_run_id: &'life1 str,
_owner: &'life2 str,
_ttl: Duration,
) -> Pin<Box<dyn Future<Output = Result<Result<(), LeaseHolder>, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn renew_lease<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_run_id: &'life1 str,
_owner: &'life2 str,
_ttl: Duration,
) -> Pin<Box<dyn Future<Output = Result<bool, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn release_lease<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_run_id: &'life1 str,
_owner: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), JournalError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Expand description
Append-only, per-run event storage.
Journals may also implement run leases so that only one worker drives a run at a time. The defaults grant every lease (no coordination), which is correct for single-worker setups; sequence checks still prevent corrupt histories either way.
Implementations must reject an append whose seq is not exactly the next
position; this is what makes concurrent resumers safe.
Required Methods§
fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 Event,
) -> Pin<Box<dyn Future<Output = Result<(), JournalError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, JournalError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Provided Methods§
Sourcefn acquire_lease<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_run_id: &'life1 str,
_owner: &'life2 str,
_ttl: Duration,
) -> Pin<Box<dyn Future<Output = Result<Result<(), LeaseHolder>, JournalError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn acquire_lease<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_run_id: &'life1 str,
_owner: &'life2 str,
_ttl: Duration,
) -> Pin<Box<dyn Future<Output = Result<Result<(), LeaseHolder>, JournalError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Take (or re-take) the lease on run_id for ttl. Returns the current
holder if another live owner has it.
Sourcefn renew_lease<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_run_id: &'life1 str,
_owner: &'life2 str,
_ttl: Duration,
) -> Pin<Box<dyn Future<Output = Result<bool, JournalError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn renew_lease<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_run_id: &'life1 str,
_owner: &'life2 str,
_ttl: Duration,
) -> Pin<Box<dyn Future<Output = Result<bool, JournalError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Extend a lease this owner holds. false means it was lost.
fn release_lease<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_run_id: &'life1 str,
_owner: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), JournalError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".