[−][src]Struct exonum::blockchain::BlockchainMut
Mutable blockchain capable of processing transactions.
BlockchainMut
combines Blockchain
resources with a service dispatcher. The resulting
combination cannot be cloned (unlike Blockchain
), but can be sent across threads. It is
possible to extract a Blockchain
reference from BlockchainMut
via AsRef
trait.
Methods
impl BlockchainMut
[src]
pub fn immutable_view(&self) -> Blockchain
[src]
Returns a copy of immutable blockchain view.
pub fn snapshot(&self) -> Box<dyn Snapshot>
[src]
Creates a read-only snapshot of the current storage state.
pub fn fork(&self) -> Fork
[src]
Creates a snapshot of the current storage state that can be later committed into the storage
via the merge
method.
pub fn merge(&mut self, patch: Patch) -> StorageResult<()>
[src]
Commits changes from the patch to the blockchain storage.
See Fork
for details.
pub fn create_patch(
&self,
proposer_id: ValidatorId,
height: Height,
tx_hashes: &[Hash],
tx_cache: &mut BTreeMap<Hash, Verified<AnyTx>>
) -> (Hash, Patch)
[src]
&self,
proposer_id: ValidatorId,
height: Height,
tx_hashes: &[Hash],
tx_cache: &mut BTreeMap<Hash, Verified<AnyTx>>
) -> (Hash, Patch)
Executes the given transactions from the pool. Then collects the resulting changes from the current storage state and returns them with the hash of the resulting block.
pub fn commit<I>(
&mut self,
patch: Patch,
block_hash: Hash,
precommits: I,
tx_cache: &mut BTreeMap<Hash, Verified<AnyTx>>
) -> Result<(), Error> where
I: IntoIterator<Item = Verified<Precommit>>,
[src]
&mut self,
patch: Patch,
block_hash: Hash,
precommits: I,
tx_cache: &mut BTreeMap<Hash, Verified<AnyTx>>
) -> Result<(), Error> where
I: IntoIterator<Item = Verified<Precommit>>,
Commits to the blockchain a new block with the indicated changes (patch),
hash and Precommit messages. After that invokes after_commit
for each service in the increasing order of their identifiers.
pub fn check_tx(&self, tx: &Verified<AnyTx>) -> Result<(), ExecutionError>
[src]
Performs several shallow checks that transaction is correct.
Returned Ok(())
value doesn't necessarily mean that transaction is correct and will be
executed successfully, but returned Err(..)
value means that this transaction is
obviously incorrect and should be declined as early as possible.
pub fn shutdown(&mut self)
[src]
Shuts down the dispatcher. This should be the last operation performed on this instance.
pub fn remove_peer_with_pubkey(&mut self, key: &PublicKey)
[src]
Removes from the cache the Connect
message from a peer.
Trait Implementations
impl AsRef<Blockchain> for BlockchainMut
[src]
fn as_ref(&self) -> &Blockchain
[src]
impl Debug for BlockchainMut
[src]
Auto Trait Implementations
impl Send for BlockchainMut
impl !Sync for BlockchainMut
impl Unpin for BlockchainMut
impl !UnwindSafe for BlockchainMut
impl !RefUnwindSafe for BlockchainMut
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,