pub enum Chain<State: StateInstance, T> {
Block(BlockChain<State, T>),
Sync(SyncChain<State, T>),
}
Expand description
A data structure responsible for maintaining the integrity of a mutable subject.
Variants§
Block(BlockChain<State, T>)
Sync(SyncChain<State, T>)
Trait Implementations§
source§impl<State, T> AsyncHash for Chain<State, T>where
State: StateInstance,
State::FE: AsType<ChainBlock> + for<'a> FileSave<'a> + ThreadSafe,
T: AsyncHash + Send + Sync,
impl<State, T> AsyncHash for Chain<State, T>where
State: StateInstance,
State::FE: AsType<ChainBlock> + for<'a> FileSave<'a> + ThreadSafe,
T: AsyncHash + Send + Sync,
source§impl<State, T> ChainInstance<State, T> for Chain<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,
Collection<State::Txn, State::FE>: TryCastFrom<State>,
Scalar: TryCastFrom<State>,
impl<State, T> ChainInstance<State, T> for Chain<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,
Collection<State::Txn, State::FE>: TryCastFrom<State>,
Scalar: TryCastFrom<State>,
source§impl<State, T> CopyFrom<<State as StateInstance>::FE, Chain<State, T>> for Chain<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, Chain<State, T>> for Chain<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> From<BlockChain<State, T>> for Chain<State, T>where
State: StateInstance,
impl<State, T> From<BlockChain<State, T>> for Chain<State, T>where
State: StateInstance,
source§fn from(chain: BlockChain<State, T>) -> Self
fn from(chain: BlockChain<State, T>) -> Self
Converts to this type from the input type.
source§impl<State, T> FromStream for Chain<State, T>where
State: StateInstance + FromStream<Context = State::Txn> + From<Collection<State::Txn, State::FE>> + From<Scalar>,
State::FE: DenseCacheFile + AsType<ChainBlock> + AsType<Node> + AsType<Node> + for<'a> FileSave<'a>,
T: Route<State> + FromStream<Context = State::Txn> + Debug,
(Bytes, Map<Tuple<State>>): TryCastFrom<State>,
Collection<State::Txn, State::FE>: TryCastFrom<State>,
Scalar: TryCastFrom<State>,
Value: TryCastFrom<State>,
(Value,): TryCastFrom<State>,
(Value, State): TryCastFrom<State>,
impl<State, T> FromStream for Chain<State, T>where
State: StateInstance + FromStream<Context = State::Txn> + From<Collection<State::Txn, State::FE>> + From<Scalar>,
State::FE: DenseCacheFile + AsType<ChainBlock> + AsType<Node> + AsType<Node> + for<'a> FileSave<'a>,
T: Route<State> + FromStream<Context = State::Txn> + Debug,
(Bytes, Map<Tuple<State>>): TryCastFrom<State>,
Collection<State::Txn, State::FE>: TryCastFrom<State>,
Scalar: TryCastFrom<State>,
Value: TryCastFrom<State>,
(Value,): TryCastFrom<State>,
(Value, State): TryCastFrom<State>,
§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 Chain<State, T>where
State: StateInstance,
T: IntoView<'en, State::FE, Txn = State::Txn> + Send + Sync + 'en,
BlockChain<State, T>: IntoView<'en, State::FE, View = (T::View, SeqStream<TCResult<(Bytes, MapStream<TxnId, TCResult<SeqStream<TCResult<MutationView<'en>>, TCBoxTryStream<'en, MutationView<'en>>>>, TCBoxStream<'en, (TxnId, TCResult<SeqStream<TCResult<MutationView<'en>>, TCBoxTryStream<'en, MutationView<'en>>>>)>>)>, TCBoxTryStream<'en, (Bytes, MapStream<TxnId, TCResult<SeqStream<TCResult<MutationView<'en>>, TCBoxTryStream<'en, MutationView<'en>>>>, TCBoxStream<'en, (TxnId, TCResult<SeqStream<TCResult<MutationView<'en>>, TCBoxTryStream<'en, MutationView<'en>>>>)>>)>>), Txn = State::Txn> + Send + Sync,
SyncChain<State, T>: IntoView<'en, State::FE, View = T::View, Txn = State::Txn> + Send + Sync,
impl<'en, State, T> IntoView<'en, <State as StateInstance>::FE> for Chain<State, T>where
State: StateInstance,
T: IntoView<'en, State::FE, Txn = State::Txn> + Send + Sync + 'en,
BlockChain<State, T>: IntoView<'en, State::FE, View = (T::View, SeqStream<TCResult<(Bytes, MapStream<TxnId, TCResult<SeqStream<TCResult<MutationView<'en>>, TCBoxTryStream<'en, MutationView<'en>>>>, TCBoxStream<'en, (TxnId, TCResult<SeqStream<TCResult<MutationView<'en>>, TCBoxTryStream<'en, MutationView<'en>>>>)>>)>, TCBoxTryStream<'en, (Bytes, MapStream<TxnId, TCResult<SeqStream<TCResult<MutationView<'en>>, TCBoxTryStream<'en, MutationView<'en>>>>, TCBoxStream<'en, (TxnId, TCResult<SeqStream<TCResult<MutationView<'en>>, TCBoxTryStream<'en, MutationView<'en>>>>)>>)>>), Txn = State::Txn> + Send + Sync,
SyncChain<State, T>: IntoView<'en, State::FE, View = T::View, Txn = State::Txn> + Send + Sync,
§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 Chain<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> Persist<<State as StateInstance>::FE> for Chain<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,
type Txn = <State as StateInstance>::Txn
type Schema = (ChainType, <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 Chain<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 Chain<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> Route<State> for Chain<State, T>where
State: StateInstance,
T: Persist<State::FE, Txn = State::Txn> + Route<State> + Clone + Debug,
Self: ChainInstance<State, T>,
impl<State, T> Route<State> for Chain<State, T>where
State: StateInstance,
T: Persist<State::FE, Txn = State::Txn> + Route<State> + Clone + Debug,
Self: ChainInstance<State, T>,
source§impl<State, T> Transact for Chain<State, T>
impl<State, T> Transact for Chain<State, T>
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 Chain<State, T>
impl<State, T> Send for Chain<State, T>where
T: Send,
impl<State, T> Sync for Chain<State, T>where
T: Sync,
impl<State, T> Unpin for Chain<State, T>
impl<State, T> !UnwindSafe for Chain<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<State, T> Public<State> for T
impl<State, T> Public<State> for T
fn get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
txn: &'life1 <State as StateInstance>::Txn,
path: &'life2 [Id],
key: Value
) -> Pin<Box<dyn Future<Output = Result<State, TCError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
T: 'async_trait,
fn put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
txn: &'life1 <State as StateInstance>::Txn,
path: &'life2 [Id],
key: Value,
value: State
) -> Pin<Box<dyn Future<Output = Result<(), TCError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
T: 'async_trait,
fn post<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
txn: &'life1 <State as StateInstance>::Txn,
path: &'life2 [Id],
params: Map<State>
) -> Pin<Box<dyn Future<Output = Result<State, TCError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
T: 'async_trait,
fn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
txn: &'life1 <State as StateInstance>::Txn,
path: &'life2 [Id],
key: Value
) -> Pin<Box<dyn Future<Output = Result<(), TCError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
T: 'async_trait,
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
.