pub struct SyncChain<State: StateInstance, 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, T>where
State: StateInstance,
State::FE: AsType<ChainBlock>,
T: Persist<State::FE, Txn = State::Txn> + Restore<State::FE> + TryCastFrom<State>,
impl<State, T> SyncChain<State, T>where
State: StateInstance,
State::FE: AsType<ChainBlock>,
T: Persist<State::FE, Txn = State::Txn> + Restore<State::FE> + TryCastFrom<State>,
pub async fn restore_from(&self, txn: &State::Txn, source: Link) -> TCResult<()>
Trait Implementations§
source§impl<State, T> ChainInstance<State, T> for SyncChain<State, T>where
State: StateInstance,
State::FE: DenseCacheFile + AsType<ChainBlock> + AsType<Node> + AsType<Node>,
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, T>where
State: StateInstance,
State::FE: DenseCacheFile + AsType<ChainBlock> + AsType<Node> + AsType<Node>,
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, T>> for SyncChain<State, T>where
State: StateInstance,
State::FE: DenseCacheFile + AsType<Node> + AsType<ChainBlock> + AsType<Node> + for<'a> FileSave<'a>,
T: Persist<State::FE, Txn = State::Txn> + Route<State> + Debug,
impl<State, T> CopyFrom<<State as StateInstance>::FE, SyncChain<State, T>> for SyncChain<State, T>where
State: StateInstance,
State::FE: DenseCacheFile + AsType<Node> + AsType<ChainBlock> + AsType<Node> + for<'a> FileSave<'a>,
T: Persist<State::FE, Txn = State::Txn> + Route<State> + Debug,
source§impl<State, T> Debug for SyncChain<State, T>where
State: StateInstance,
impl<State, T> Debug for SyncChain<State, T>where
State: StateInstance,
source§impl<State, T> FromStream for SyncChain<State, T>where
State: StateInstance,
State::FE: DenseCacheFile + AsType<Node> + AsType<ChainBlock> + AsType<Node>,
T: FromStream<Context = State::Txn>,
impl<State, T> FromStream for SyncChain<State, T>where
State: StateInstance,
State::FE: DenseCacheFile + AsType<Node> + AsType<ChainBlock> + AsType<Node>,
T: FromStream<Context = State::Txn>,
§type Context = <State as StateInstance>::Txn
type Context = <State as StateInstance>::Txn
The decoding context of this type, useful in situations where the stream to be decoded
may be too large to hold in main memory. Read more
source§impl<'en, State, T> IntoView<'en, <State as StateInstance>::FE> for SyncChain<State, T>
impl<'en, State, T> IntoView<'en, <State as StateInstance>::FE> for SyncChain<State, T>
§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, T>where
State: StateInstance,
State::FE: DenseCacheFile + AsType<Node> + AsType<ChainBlock> + AsType<Node> + for<'a> FileSave<'a>,
T: Persist<State::FE, Txn = State::Txn> + Send + Sync,
impl<State, T> Persist<<State as StateInstance>::FE> for SyncChain<State, T>where
State: StateInstance,
State::FE: DenseCacheFile + AsType<Node> + AsType<ChainBlock> + AsType<Node> + 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, T>where
State: StateInstance + From<Collection<State::Txn, State::FE>> + From<Scalar>,
State::FE: DenseCacheFile + AsType<Node> + AsType<Node> + AsType<ChainBlock> + for<'a> FileSave<'a>,
T: Route<State> + Debug + Send + Sync,
Collection<State::Txn, State::FE>: TryCastFrom<State>,
Scalar: TryCastFrom<State>,
Node: FileLoad,
impl<State, T> Recover<<State as StateInstance>::FE> for SyncChain<State, T>where
State: StateInstance + From<Collection<State::Txn, State::FE>> + From<Scalar>,
State::FE: DenseCacheFile + AsType<Node> + AsType<Node> + AsType<ChainBlock> + for<'a> FileSave<'a>,
T: Route<State> + Debug + Send + Sync,
Collection<State::Txn, State::FE>: TryCastFrom<State>,
Scalar: TryCastFrom<State>,
Node: FileLoad,
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> Transact for SyncChain<State, T>where
State: StateInstance,
State::FE: AsType<ChainBlock> + for<'a> FileSave<'a>,
T: Transact + Send + Sync,
impl<State, T> Transact for SyncChain<State, 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, T> !RefUnwindSafe for SyncChain<State, T>
impl<State, T> Send for SyncChain<State, T>where
T: Send,
impl<State, T> Sync for SyncChain<State, T>where
T: Sync,
impl<State, T> Unpin for SyncChain<State, T>
impl<State, T> !UnwindSafe for SyncChain<State, 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<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
.§impl<T> Pointable for T
impl<T> Pointable for 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
.