pub struct SyncChain<State, Txn, FE, T> { /* private fields */ }
Expand description
A super::Chain
which keeps only the data needed to recover the state of its subject in the
event of a transaction failure.
Implementations§
Source§impl<State, T> SyncChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: AsType<ChainBlock>,
T: Persist<State::FE, Txn = State::Txn> + Restore<State::FE> + TryCastFrom<State>,
Self: TryCastFrom<State>,
impl<State, T> SyncChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: AsType<ChainBlock>,
T: Persist<State::FE, Txn = State::Txn> + Restore<State::FE> + TryCastFrom<State>,
Self: TryCastFrom<State>,
Trait Implementations§
Source§impl<State, T> ChainInstance<State, T> for SyncChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: CacheBlock,
T: Persist<State::FE, Txn = State::Txn> + Route<State> + Debug,
Collection<State::Txn, State::FE>: TryCastFrom<State>,
Scalar: TryCastFrom<State>,
impl<State, T> ChainInstance<State, T> for SyncChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: CacheBlock,
T: Persist<State::FE, Txn = State::Txn> + Route<State> + Debug,
Collection<State::Txn, State::FE>: TryCastFrom<State>,
Scalar: TryCastFrom<State>,
Source§impl<State, T> CopyFrom<<State as StateInstance>::FE, SyncChain<State, <State as StateInstance>::Txn, <State as StateInstance>::FE, T>> for SyncChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: CacheBlock + for<'a> FileSave<'a>,
T: Persist<State::FE, Txn = State::Txn> + Route<State> + Debug,
impl<State, T> CopyFrom<<State as StateInstance>::FE, SyncChain<State, <State as StateInstance>::Txn, <State as StateInstance>::FE, T>> for SyncChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: CacheBlock + for<'a> FileSave<'a>,
T: Persist<State::FE, Txn = State::Txn> + Route<State> + Debug,
Source§impl<State, T> FromStream for SyncChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: CacheBlock + for<'a> FileSave<'a>,
T: FromStream<Context = State::Txn>,
impl<State, T> FromStream for SyncChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: CacheBlock + for<'a> FileSave<'a>,
T: FromStream<Context = State::Txn>,
Source§impl<'en, State, T> IntoView<'en, <State as StateInstance>::FE> for SyncChain<State, State::Txn, State::FE, T>
impl<'en, State, T> IntoView<'en, <State as StateInstance>::FE> for SyncChain<State, State::Txn, State::FE, T>
Source§type Txn = <State as StateInstance>::Txn
type Txn = <State as StateInstance>::Txn
The type of
Transaction
which this state supportsSource§impl<State, T> Persist<<State as StateInstance>::FE> for SyncChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: CacheBlock + for<'a> FileSave<'a>,
T: Persist<State::FE, Txn = State::Txn> + Send + Sync,
impl<State, T> Persist<<State as StateInstance>::FE> for SyncChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: CacheBlock + for<'a> FileSave<'a>,
T: Persist<State::FE, Txn = State::Txn> + Send + Sync,
type Txn = <State as StateInstance>::Txn
type Schema = <T as Persist<<State as StateInstance>::FE>>::Schema
Source§fn create<'async_trait>(
txn_id: TxnId,
schema: Self::Schema,
store: Dir<State::FE>,
) -> Pin<Box<dyn Future<Output = TCResult<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
fn create<'async_trait>(
txn_id: TxnId,
schema: Self::Schema,
store: Dir<State::FE>,
) -> Pin<Box<dyn Future<Output = TCResult<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
Create a new instance of
Self
from an empty Store
.Source§fn load<'async_trait>(
txn_id: TxnId,
schema: Self::Schema,
store: Dir<State::FE>,
) -> Pin<Box<dyn Future<Output = TCResult<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
fn load<'async_trait>(
txn_id: TxnId,
schema: Self::Schema,
store: Dir<State::FE>,
) -> Pin<Box<dyn Future<Output = TCResult<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
Load a saved instance of
Self
from persistent storage.
Should only be invoked at startup time.Source§impl<State, T> Recover<<State as StateInstance>::FE> for SyncChain<State, State::Txn, State::FE, T>where
State: StateInstance + From<Collection<State::Txn, State::FE>> + From<Scalar>,
State::FE: CacheBlock + for<'a> FileSave<'a>,
T: Route<State> + Debug + Send + Sync,
Collection<State::Txn, State::FE>: TryCastFrom<State>,
Scalar: TryCastFrom<State>,
impl<State, T> Recover<<State as StateInstance>::FE> for SyncChain<State, State::Txn, State::FE, T>where
State: StateInstance + From<Collection<State::Txn, State::FE>> + From<Scalar>,
State::FE: CacheBlock + for<'a> FileSave<'a>,
T: Route<State> + Debug + Send + Sync,
Collection<State::Txn, State::FE>: TryCastFrom<State>,
Scalar: TryCastFrom<State>,
type Txn = <State as StateInstance>::Txn
Source§fn recover<'life0, 'life1, 'async_trait>(
&'life0 self,
txn: &'life1 State::Txn,
) -> Pin<Box<dyn Future<Output = TCResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn recover<'life0, 'life1, 'async_trait>(
&'life0 self,
txn: &'life1 State::Txn,
) -> Pin<Box<dyn Future<Output = TCResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Recover this state after loading, in case the last transaction failed or was interrupted.
Source§impl<State, T> Replicate<<State as StateInstance>::Txn> for SyncChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: AsType<ChainBlock>,
T: Persist<State::FE, Txn = State::Txn> + Restore<State::FE> + TryCastFrom<State> + AsyncHash + Send + Sync,
Self: TryCastFrom<State>,
impl<State, T> Replicate<<State as StateInstance>::Txn> for SyncChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: AsType<ChainBlock>,
T: Persist<State::FE, Txn = State::Txn> + Restore<State::FE> + TryCastFrom<State> + AsyncHash + Send + Sync,
Self: TryCastFrom<State>,
Source§fn replicate<'life0, 'life1, 'async_trait>(
&'life0 self,
txn: &'life1 State::Txn,
source: Link,
) -> Pin<Box<dyn Future<Output = TCResult<Output<Sha256>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn replicate<'life0, 'life1, 'async_trait>(
&'life0 self,
txn: &'life1 State::Txn,
source: Link,
) -> Pin<Box<dyn Future<Output = TCResult<Output<Sha256>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update the state of this replica from the given
source
.Source§impl<State, T> Transact for SyncChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: AsType<ChainBlock> + for<'a> FileSave<'a>,
T: Transact + Send + Sync,
impl<State, T> Transact for SyncChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: AsType<ChainBlock> + for<'a> FileSave<'a>,
T: Transact + Send + Sync,
Source§fn commit<'life0, 'async_trait>(
&'life0 self,
txn_id: TxnId,
) -> Pin<Box<dyn Future<Output = Self::Commit> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn commit<'life0, 'async_trait>(
&'life0 self,
txn_id: TxnId,
) -> Pin<Box<dyn Future<Output = Self::Commit> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Commit this transaction.
Auto Trait Implementations§
impl<State, Txn, FE, T> Freeze for SyncChain<State, Txn, FE, T>where
T: Freeze,
impl<State, Txn, FE, T> !RefUnwindSafe for SyncChain<State, Txn, FE, T>
impl<State, Txn, FE, T> Send for SyncChain<State, Txn, FE, T>
impl<State, Txn, FE, T> Sync for SyncChain<State, Txn, FE, T>
impl<State, Txn, FE, T> Unpin for SyncChain<State, Txn, FE, T>
impl<State, Txn, FE, T> !UnwindSafe for SyncChain<State, Txn, FE, T>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F> Match for F
impl<F> Match for F
Source§fn matches<T>(&self) -> boolwhere
T: TryCastFrom<Self>,
fn matches<T>(&self) -> boolwhere
T: TryCastFrom<Self>,
Returns
true
if self
can be cast into the target type T
.Source§impl<F, T> TryCastFrom<F> for Twhere
T: CastFrom<F>,
impl<F, T> TryCastFrom<F> for Twhere
T: CastFrom<F>,
Source§fn can_cast_from(_: &F) -> bool
fn can_cast_from(_: &F) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(f: F) -> Option<T>
fn opt_cast_from(f: F) -> Option<T>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<F, T> TryCastInto<T> for Fwhere
T: TryCastFrom<F>,
impl<F, T> TryCastInto<T> for Fwhere
T: TryCastFrom<F>,
Source§fn can_cast_into(&self) -> bool
fn can_cast_into(&self) -> bool
Test if
self
can be cast into T
.Source§fn opt_cast_into(self) -> Option<T>
fn opt_cast_into(self) -> Option<T>
Returns
Some(T)
if self
can be cast into T
, otherwise None
.Source§fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err>where
OnErr: FnOnce(&Self) -> Err,
fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err>where
OnErr: FnOnce(&Self) -> Err,
Returns
Ok(T)
if self
can be cast into T
, otherwise calls on_err
.