pub struct BlockChain<State, Txn, FE, T> { /* private fields */ }
Expand description
A Chain
which stores every mutation of its subject in a series of ChainBlock
s
Implementations§
Source§impl<State, Txn, FE, T> BlockChain<State, Txn, FE, T>
impl<State, Txn, FE, T> BlockChain<State, Txn, FE, T>
Trait Implementations§
Source§impl<State, T> ChainInstance<State, T> for BlockChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: CacheBlock + for<'a> FileSave<'a>,
T: Route<State> + Debug,
Collection<State::Txn, State::FE>: TryCastFrom<State>,
Scalar: TryCastFrom<State>,
impl<State, T> ChainInstance<State, T> for BlockChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: CacheBlock + for<'a> FileSave<'a>,
T: Route<State> + Debug,
Collection<State::Txn, State::FE>: TryCastFrom<State>,
Scalar: TryCastFrom<State>,
Source§impl<State, Txn, FE, T> Clone for BlockChain<State, Txn, FE, T>where
T: Clone,
impl<State, Txn, FE, T> Clone for BlockChain<State, Txn, FE, T>where
T: Clone,
Source§impl<State, T> CopyFrom<<State as StateInstance>::FE, BlockChain<State, <State as StateInstance>::Txn, <State as StateInstance>::FE, T>> for BlockChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: CacheBlock + for<'a> FileSave<'a>,
T: Route<State> + Persist<State::FE, Txn = State::Txn> + Debug,
impl<State, T> CopyFrom<<State as StateInstance>::FE, BlockChain<State, <State as StateInstance>::Txn, <State as StateInstance>::FE, T>> for BlockChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: CacheBlock + for<'a> FileSave<'a>,
T: Route<State> + Persist<State::FE, Txn = State::Txn> + Debug,
Source§impl<State, Txn, FE, T> Debug for BlockChain<State, Txn, FE, T>
impl<State, Txn, FE, T> Debug for BlockChain<State, Txn, FE, T>
Source§impl<State, Txn, FE, T> From<BlockChain<State, Txn, FE, T>> for Chain<State, Txn, FE, T>
impl<State, Txn, FE, T> From<BlockChain<State, Txn, FE, T>> for Chain<State, Txn, FE, T>
Source§fn from(chain: BlockChain<State, Txn, FE, T>) -> Self
fn from(chain: BlockChain<State, Txn, FE, T>) -> Self
Converts to this type from the input type.
Source§impl<State, T> FromStream for BlockChain<State, State::Txn, State::FE, T>where
State: StateInstance + FromStream<Context = State::Txn> + From<Collection<State::Txn, State::FE>> + From<Scalar>,
State::FE: CacheBlock + 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 BlockChain<State, State::Txn, State::FE, T>where
State: StateInstance + FromStream<Context = State::Txn> + From<Collection<State::Txn, State::FE>> + From<Scalar>,
State::FE: CacheBlock + 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>,
Source§impl<'en, State, T> IntoView<'en, <State as StateInstance>::FE> for BlockChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: CacheBlock + for<'a> FileSave<'a>,
T: IntoView<'en, State::FE, Txn = State::Txn> + Send + Sync,
impl<'en, State, T> IntoView<'en, <State as StateInstance>::FE> for BlockChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: CacheBlock + for<'a> FileSave<'a>,
T: IntoView<'en, State::FE, Txn = State::Txn> + Send + Sync,
Source§type Txn = <State as StateInstance>::Txn
type Txn = <State as StateInstance>::Txn
The type of
Transaction
which this state supportsSource§type View = (<T as IntoView<'en, <State as StateInstance>::FE>>::View, SeqStream<Result<(Bytes, MapStream<TxnId, Result<SeqStream<Result<MutationView<'en>, TCError>, Pin<Box<dyn Stream<Item = Result<MutationView<'en>, TCError>> + Send + Unpin + 'en>>>, TCError>, Pin<Box<dyn Stream<Item = (TxnId, Result<SeqStream<Result<MutationView<'en>, TCError>, Pin<Box<dyn Stream<Item = Result<MutationView<'en>, TCError>> + Send + Unpin + 'en>>>, TCError>)> + Send + Unpin + 'en>>>), TCError>, Pin<Box<dyn Stream<Item = Result<(Bytes, MapStream<TxnId, Result<SeqStream<Result<MutationView<'en>, TCError>, Pin<Box<dyn Stream<Item = Result<MutationView<'en>, TCError>> + Send + Unpin + 'en>>>, TCError>, Pin<Box<dyn Stream<Item = (TxnId, Result<SeqStream<Result<MutationView<'en>, TCError>, Pin<Box<dyn Stream<Item = Result<MutationView<'en>, TCError>> + Send + Unpin + 'en>>>, TCError>)> + Send + Unpin + 'en>>>), TCError>> + Send + Unpin + 'en>>>)
type View = (<T as IntoView<'en, <State as StateInstance>::FE>>::View, SeqStream<Result<(Bytes, MapStream<TxnId, Result<SeqStream<Result<MutationView<'en>, TCError>, Pin<Box<dyn Stream<Item = Result<MutationView<'en>, TCError>> + Send + Unpin + 'en>>>, TCError>, Pin<Box<dyn Stream<Item = (TxnId, Result<SeqStream<Result<MutationView<'en>, TCError>, Pin<Box<dyn Stream<Item = Result<MutationView<'en>, TCError>> + Send + Unpin + 'en>>>, TCError>)> + Send + Unpin + 'en>>>), TCError>, Pin<Box<dyn Stream<Item = Result<(Bytes, MapStream<TxnId, Result<SeqStream<Result<MutationView<'en>, TCError>, Pin<Box<dyn Stream<Item = Result<MutationView<'en>, TCError>> + Send + Unpin + 'en>>>, TCError>, Pin<Box<dyn Stream<Item = (TxnId, Result<SeqStream<Result<MutationView<'en>, TCError>, Pin<Box<dyn Stream<Item = Result<MutationView<'en>, TCError>> + Send + Unpin + 'en>>>, TCError>)> + Send + Unpin + 'en>>>), TCError>> + Send + Unpin + 'en>>>)
The type of encodable view returned by
into_view
Source§impl<State, T> Persist<<State as StateInstance>::FE> for BlockChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: CacheBlock + for<'a> FileSave<'a>,
T: Route<State> + Persist<State::FE, Txn = State::Txn> + Debug,
impl<State, T> Persist<<State as StateInstance>::FE> for BlockChain<State, State::Txn, State::FE, T>where
State: StateInstance,
State::FE: CacheBlock + for<'a> FileSave<'a>,
T: Route<State> + Persist<State::FE, Txn = State::Txn> + Debug,
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 BlockChain<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,
Collection<State::Txn, State::FE>: TryCastFrom<State>,
Scalar: TryCastFrom<State>,
impl<State, T> Recover<<State as StateInstance>::FE> for BlockChain<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,
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> Replicate<<State as StateInstance>::Txn> for BlockChain<State, State::Txn, State::FE, CollectionBase<State::Txn, State::FE>>where
State: StateInstance + From<Collection<State::Txn, State::FE>> + From<Scalar>,
State::FE: CacheBlock,
Collection<State::Txn, State::FE>: TryCastFrom<State>,
CollectionBase<State::Txn, State::FE>: Route<State>,
Scalar: TryCastFrom<State>,
Self: TryCastFrom<State>,
impl<State> Replicate<<State as StateInstance>::Txn> for BlockChain<State, State::Txn, State::FE, CollectionBase<State::Txn, State::FE>>where
State: StateInstance + From<Collection<State::Txn, State::FE>> + From<Scalar>,
State::FE: CacheBlock,
Collection<State::Txn, State::FE>: TryCastFrom<State>,
CollectionBase<State::Txn, State::FE>: Route<State>,
Scalar: TryCastFrom<State>,
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> Route<State> for BlockChain<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> + Clone + Debug,
Collection<State::Txn, State::FE>: TryCastFrom<State>,
Scalar: TryCastFrom<State>,
impl<State, T> Route<State> for BlockChain<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> + Clone + Debug,
Collection<State::Txn, State::FE>: TryCastFrom<State>,
Scalar: TryCastFrom<State>,
Source§impl<State, T> Transact for BlockChain<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 BlockChain<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 BlockChain<State, Txn, FE, T>where
T: Freeze,
impl<State, Txn, FE, T> !RefUnwindSafe for BlockChain<State, Txn, FE, T>
impl<State, Txn, FE, T> Send for BlockChain<State, Txn, FE, T>
impl<State, Txn, FE, T> Sync for BlockChain<State, Txn, FE, T>
impl<State, Txn, FE, T> Unpin for BlockChain<State, Txn, FE, T>
impl<State, Txn, FE, T> !UnwindSafe for BlockChain<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<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
.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
.