[][src]Struct exonum::runtime::BlockchainData

pub struct BlockchainData<T> { /* fields omitted */ }

Provides access to blockchain data for the executing service.

Methods

impl<T: RawAccess + AsReadonly> BlockchainData<T>[src]

pub fn new(access: T, instance_name: impl Into<String>) -> Self[src]

Creates structured access to blockchain data based on the unstructured access (e.g., a Snapshot or a Fork) and the descriptor of the executing service.

pub fn instance_name(&self) -> &str[src]

Returns the instance name of the executing service.

pub fn for_core(&self) -> CoreSchema<T::Readonly>[src]

Returns core schema.

pub fn for_dispatcher(&self) -> DispatcherSchema<T::Readonly>[src]

Returns dispatcher schema.

pub fn for_service<'q>(
    &self,
    id: impl Into<InstanceQuery<'q>>
) -> Option<Prefixed<T::Readonly>>
[src]

Returns a mount point for another service. If the service with id does not exist, returns None.

Safety

This method does not check the service type; the caller is responsible for constructing a schema of a correct type around the returned access. Constructing an incorrect schema can lead to a panic or unexpected behavior. Use service_schema as a safer alternative, which performs all necessary checks.

pub fn service_schema<'q, S, I>(
    &self,
    service_id: I
) -> Result<S, ArtifactReqError> where
    S: RequireArtifact + FromAccess<Prefixed<T::Readonly>>,
    I: Into<InstanceQuery<'q>>, 
[src]

Retrieves schema for a service.

Errors

Returns an error in the following situations (see ArtifactReqError for more details):

  • Service with the given ID does not exist
  • Service has an unexpected artifact name
  • Service has an incompatible artifact version

pub fn for_executing_service(&self) -> Prefixed<T>[src]

Returns a mount point for the data of the executing service instance. Unlike other data, this one may be writeable provided that this BlockchainData wraps a Fork.

impl<'_> BlockchainData<&'_ dyn Snapshot>[src]

pub fn proof_for_service_index(&self, index_name: &str) -> Option<IndexProof>[src]

Returns a proof for a Merkelized index with the specified name in the currently executing service.

Return value

If the index does not exist or is not Merkelized, returns None. Note that this may occur before the index is accessed the first time, which, depending on the service logic, may happen indefinitely after the service has been initialized. Thus, unwrapping the returned value may unexpectedly lead to a panic unless the index is initialized early (e.g., during service initialization).

impl<'a, T> BlockchainData<T> where
    T: Into<GenericRawAccess<'a>>, 
[src]

pub fn erase_access(self) -> BlockchainData<GenericRawAccess<'a>>[src]

Erases the enclosed access, converting it to the generic form.

Trait Implementations

impl<T: Clone> Clone for BlockchainData<T>[src]

impl<T: Debug> Debug for BlockchainData<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for BlockchainData<T> where
    T: RefUnwindSafe

impl<T> Send for BlockchainData<T> where
    T: Send

impl<T> Sync for BlockchainData<T> where
    T: Sync

impl<T> Unpin for BlockchainData<T> where
    T: Unpin

impl<T> UnwindSafe for BlockchainData<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,