Struct tc_chain::BlockChain
source · pub struct BlockChain<State: StateInstance, T> { /* private fields */ }
Expand description
A Chain
which stores every mutation of its subject in a series of ChainBlock
s
Implementations§
source§impl<State, T> BlockChain<State, T>where
State: StateInstance,
impl<State, T> BlockChain<State, T>where
State: StateInstance,
Trait Implementations§
source§impl<State, T> AsyncHash for BlockChain<State, T>
impl<State, T> AsyncHash for BlockChain<State, T>
source§impl<State, T> ChainInstance<State, T> for BlockChain<State, T>where
State: StateInstance,
State::FE: DenseCacheFile + AsType<Node> + AsType<ChainBlock> + AsType<Node> + 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, T>where
State: StateInstance,
State::FE: DenseCacheFile + AsType<Node> + AsType<ChainBlock> + AsType<Node> + for<'a> FileSave<'a>,
T: Route<State> + Debug,
Collection<State::Txn, State::FE>: TryCastFrom<State>,
Scalar: TryCastFrom<State>,
source§impl<State: Clone + StateInstance, T: Clone> Clone for BlockChain<State, T>
impl<State: Clone + StateInstance, T: Clone> Clone for BlockChain<State, T>
source§fn clone(&self) -> BlockChain<State, T>
fn clone(&self) -> BlockChain<State, T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<State, T> CopyFrom<<State as StateInstance>::FE, BlockChain<State, T>> for BlockChain<State, T>where
State: StateInstance,
State::FE: DenseCacheFile + AsType<Node> + AsType<ChainBlock> + AsType<Node> + for<'a> FileSave<'a>,
T: Route<State> + Persist<State::FE, Txn = State::Txn> + Debug,
impl<State, T> CopyFrom<<State as StateInstance>::FE, BlockChain<State, T>> for BlockChain<State, T>where
State: StateInstance,
State::FE: DenseCacheFile + AsType<Node> + AsType<ChainBlock> + AsType<Node> + for<'a> FileSave<'a>,
T: Route<State> + Persist<State::FE, Txn = State::Txn> + Debug,
source§impl<State, T> Debug for BlockChain<State, T>where
State: StateInstance,
impl<State, T> Debug for BlockChain<State, T>where
State: StateInstance,
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 BlockChain<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 BlockChain<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 BlockChain<State, T>where
State: StateInstance,
State::FE: DenseCacheFile + AsType<ChainBlock> + AsType<Node> + AsType<Node>,
T: IntoView<'en, State::FE, Txn = State::Txn> + Send + Sync,
impl<'en, State, T> IntoView<'en, <State as StateInstance>::FE> for BlockChain<State, T>where
State: StateInstance,
State::FE: DenseCacheFile + AsType<ChainBlock> + AsType<Node> + AsType<Node>,
T: IntoView<'en, State::FE, Txn = State::Txn> + Send + Sync,
§type Txn = <State as StateInstance>::Txn
type Txn = <State as StateInstance>::Txn
The type of
Transaction
which this state supports§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, T>where
State: StateInstance,
State::FE: DenseCacheFile + AsType<Node> + AsType<ChainBlock> + AsType<Node> + ThreadSafe + 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, T>where
State: StateInstance,
State::FE: DenseCacheFile + AsType<Node> + AsType<ChainBlock> + AsType<Node> + ThreadSafe + 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, 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,
Collection<State::Txn, State::FE>: TryCastFrom<State>,
Scalar: TryCastFrom<State>,
Node: FileLoad,
impl<State, T> Recover<<State as StateInstance>::FE> for BlockChain<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,
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 BlockChain<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> + Clone + Debug,
Collection<State::Txn, State::FE>: TryCastFrom<State>,
Scalar: TryCastFrom<State>,
impl<State, T> Route<State> for BlockChain<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> + Clone + Debug,
Collection<State::Txn, State::FE>: TryCastFrom<State>,
Scalar: TryCastFrom<State>,
source§impl<State, T> Transact for BlockChain<State, T>where
State: StateInstance,
State::FE: AsType<ChainBlock> + for<'a> FileSave<'a>,
T: Transact + Send + Sync,
impl<State, T> Transact for BlockChain<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 BlockChain<State, T>
impl<State, T> Send for BlockChain<State, T>where
T: Send,
impl<State, T> Sync for BlockChain<State, T>where
T: Sync,
impl<State, T> Unpin for BlockChain<State, T>
impl<State, T> !UnwindSafe for BlockChain<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
.