Struct DataAccessLayer

Source
pub struct DataAccessLayer<S> {
    pub block_store: BlockStore,
    pub state: S,
    pub max_query_depth: u64,
    pub enable_addressable_entity: bool,
}
Expand description

Data access layer.

Fields§

§block_store: BlockStore

Block store instance.

§state: S

Memoized state.

§max_query_depth: u64

Max query depth.

§enable_addressable_entity: bool

Enable the addressable entity capability.

Implementations§

Source§

impl<S> DataAccessLayer<S>

Source

pub fn state(&self) -> &S

Returns reference to current state of the data access layer.

Trait Implementations§

Source§

impl<S: Clone> Clone for DataAccessLayer<S>

Source§

fn clone(&self) -> DataAccessLayer<S>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S> CommitProvider for DataAccessLayer<S>
where S: CommitProvider,

Source§

fn commit_effects( &self, state_hash: Digest, effects: Effects, ) -> Result<Digest, GlobalStateError>

Applies changes and returns a new post state hash. block_hash is used for computing a deterministic and unique keys.
Source§

fn commit_values( &self, state_hash: Digest, values_to_write: Vec<(Key, StoredValue)>, keys_to_prune: BTreeSet<Key>, ) -> Result<Digest, GlobalStateError>

Commit values to global state.
Source§

fn genesis(&self, request: GenesisRequest) -> GenesisResult

Runs and commits the genesis process, once per network.
Source§

fn protocol_upgrade( &self, request: ProtocolUpgradeRequest, ) -> ProtocolUpgradeResult

Runs and commits the protocol upgrade process.
Source§

fn prune(&self, request: PruneRequest) -> PruneResult

Safely prune specified keys from global state, using a tracking copy.
Source§

fn step(&self, request: StepRequest) -> StepResult

Step auction state at era end.
Source§

fn distribute_block_rewards( &self, request: BlockRewardsRequest, ) -> BlockRewardsResult

Distribute block rewards.
Source§

fn distribute_fees(&self, request: FeeRequest) -> FeeResult

Distribute fees, if relevant to the chainspec configured behavior.
Source§

fn forced_undelegate( &self, request: ForcedUndelegateRequest, ) -> ForcedUndelegateResult

Forcibly unbonds delegator bids which fall outside configured delegation limits.
Source§

fn block_global(&self, request: BlockGlobalRequest) -> BlockGlobalResult

Gets block global data.
Source§

impl ScratchProvider for DataAccessLayer<LmdbGlobalState>

Source§

fn get_scratch_global_state(&self) -> ScratchGlobalState

Provide a local cached-only version of engine-state.

Source§

fn write_scratch_to_db( &self, state_root_hash: Digest, scratch_global_state: ScratchGlobalState, ) -> Result<Digest, GlobalStateError>

Writes state cached in an EngineState<ScratchEngineState> to LMDB.

Source§

fn prune_keys(&self, state_root_hash: Digest, keys: &[Key]) -> TriePruneResult

Prune keys.

Source§

impl<S> StateProvider for DataAccessLayer<S>
where S: StateProvider,

Source§

type Reader = <S as StateProvider>::Reader

Associated reader type for StateProvider.
Source§

fn flush(&self, request: FlushRequest) -> FlushResult

Flush the state provider.
Source§

fn empty_root(&self) -> Digest

Returns an empty root hash.
Source§

fn tracking_copy( &self, hash: Digest, ) -> Result<Option<TrackingCopy<S::Reader>>, GlobalStateError>

Get a tracking copy.
Source§

fn checkout( &self, state_hash: Digest, ) -> Result<Option<Self::Reader>, GlobalStateError>

Checkouts a slice of initial state using root state hash.
Source§

fn trie(&self, request: TrieRequest) -> TrieResult

Reads a Trie from the state if it is present
Source§

fn put_trie(&self, request: PutTrieRequest) -> PutTrieResult

Persists a trie element.
Source§

fn missing_children( &self, trie_raw: &[u8], ) -> Result<Vec<Digest>, GlobalStateError>

Finds all the children of trie_raw which aren’t present in the state.
Source§

fn enable_entity(&self) -> bool

Gets the value of enable entity flag.
Source§

fn query(&self, request: QueryRequest) -> QueryResult

Query state.
Source§

fn message_topics( &self, message_topics_request: MessageTopicsRequest, ) -> MessageTopicsResult

Message topics request.
Source§

fn balance_purse( &self, request: BalanceIdentifierPurseRequest, ) -> BalanceIdentifierPurseResult

Provides the underlying addr for the imputed balance identifier.
Source§

fn balance(&self, request: BalanceRequest) -> BalanceResult

Balance inquiry.
Source§

fn balance_hold(&self, request: BalanceHoldRequest) -> BalanceHoldResult

Balance hold.
Source§

fn era_validators(&self, request: EraValidatorsRequest) -> EraValidatorsResult

Get the requested era validators.
Source§

fn seigniorage_recipients( &self, request: SeigniorageRecipientsRequest, ) -> SeigniorageRecipientsResult

Get the requested seigniorage recipients.
Source§

fn bids(&self, request: BidsRequest) -> BidsResult

Gets the bids.
Source§

fn bidding(&self, _: BiddingRequest) -> BiddingResult

Direct auction interaction for all variations of bid management.
Source§

fn handle_refund(&self, _: HandleRefundRequest) -> HandleRefundResult

Handle refund.
Source§

fn handle_fee(&self, _: HandleFeeRequest) -> HandleFeeResult

Handle payment.
Source§

fn execution_result_checksum( &self, request: ExecutionResultsChecksumRequest, ) -> ExecutionResultsChecksumResult

Gets the execution result checksum.
Source§

fn addressable_entity( &self, request: AddressableEntityRequest, ) -> AddressableEntityResult

Gets an addressable entity.
Source§

fn system_entity_registry( &self, request: SystemEntityRegistryRequest, ) -> SystemEntityRegistryResult

Returns the system entity registry or the key for a system entity registered within it.
Source§

fn entry_point(&self, request: EntryPointRequest) -> EntryPointResult

Gets an entry point value.
Source§

fn contract(&self, request: ContractRequest) -> ContractResult

Gets a contract value.
Source§

fn entry_point_exists( &self, request: EntryPointExistsRequest, ) -> EntryPointExistsResult

Gets an entry point value.
Source§

fn total_supply(&self, request: TotalSupplyRequest) -> TotalSupplyResult

Gets total supply.
Source§

fn round_seigniorage_rate( &self, request: RoundSeigniorageRateRequest, ) -> RoundSeigniorageRateResult

Gets the current round seigniorage rate.
Source§

fn transfer(&self, request: TransferRequest) -> TransferResult

Direct transfer.
Source§

fn burn(&self, request: BurnRequest) -> BurnResult

Direct burn.
Source§

fn tagged_values(&self, request: TaggedValuesRequest) -> TaggedValuesResult

Gets all values under a given key tag.
Source§

fn prefixed_values( &self, request: PrefixedValuesRequest, ) -> PrefixedValuesResult

Gets all values under a given key prefix. Currently, this ignores the cache and only provides values from the trie.
Source§

impl<S: Copy> Copy for DataAccessLayer<S>

Auto Trait Implementations§

§

impl<S> Freeze for DataAccessLayer<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for DataAccessLayer<S>
where S: RefUnwindSafe,

§

impl<S> Send for DataAccessLayer<S>
where S: Send,

§

impl<S> Sync for DataAccessLayer<S>
where S: Sync,

§

impl<S> Unpin for DataAccessLayer<S>
where S: Unpin,

§

impl<S> UnwindSafe for DataAccessLayer<S>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more