pub struct SystemExecutionStateView<C> {
pub description: HashedLazyRegisterView<C, Option<ChainDescription>>,
pub epoch: HashedRegisterView<C, Epoch>,
pub admin_chain_id: HashedRegisterView<C, Option<ChainId>>,
pub committees: HashedLazyRegisterView<C, BTreeMap<Epoch, Committee>>,
pub ownership: HashedLazyRegisterView<C, ChainOwnership>,
pub balance: HashedRegisterView<C, Amount>,
pub balances: HashedMapView<C, AccountOwner, Amount>,
pub timestamp: HashedRegisterView<C, Timestamp>,
pub closed: HashedRegisterView<C, bool>,
pub application_permissions: HashedLazyRegisterView<C, ApplicationPermissions>,
pub used_blobs: HashedSetView<C, BlobId>,
pub event_subscriptions: HashedMapView<C, (ChainId, StreamId), EventSubscriptions>,
}Expand description
A view accessing the execution state of the system of a chain.
Fields§
§description: HashedLazyRegisterView<C, Option<ChainDescription>>How the chain was created. May be unknown for inactive chains.
epoch: HashedRegisterView<C, Epoch>The number identifying the current configuration.
admin_chain_id: HashedRegisterView<C, Option<ChainId>>The admin of the chain.
committees: HashedLazyRegisterView<C, BTreeMap<Epoch, Committee>>The committees that we trust, indexed by epoch number.
ownership: HashedLazyRegisterView<C, ChainOwnership>Ownership of the chain.
balance: HashedRegisterView<C, Amount>Balance of the chain. (Available to any user able to create blocks in the chain.)
balances: HashedMapView<C, AccountOwner, Amount>Balances attributed to a given owner.
timestamp: HashedRegisterView<C, Timestamp>The timestamp of the most recent block.
closed: HashedRegisterView<C, bool>Whether this chain has been closed.
application_permissions: HashedLazyRegisterView<C, ApplicationPermissions>Permissions for applications on this chain.
used_blobs: HashedSetView<C, BlobId>Blobs that have been used or published on this chain.
event_subscriptions: HashedMapView<C, (ChainId, StreamId), EventSubscriptions>The event stream subscriptions of applications on this chain.
Implementations§
Source§impl<C> SystemExecutionStateView<C>
impl<C> SystemExecutionStateView<C>
Sourcepub async fn is_active(&self) -> Result<bool, ViewError>
pub async fn is_active(&self) -> Result<bool, ViewError>
Invariant for the states of active chains.
Sourcepub async fn current_committee(
&self,
) -> Result<Option<(Epoch, Arc<Committee>)>, ViewError>
pub async fn current_committee( &self, ) -> Result<Option<(Epoch, Arc<Committee>)>, ViewError>
Returns the chain’s current epoch together with its committee.
Serves lookups from the process-global crate::SharedCommittees cache, falling
back to the NewCommittee event on the admin chain (or the genesis committee blob
for epoch 0). If neither source has the committee — which happens when a
CreateCommittee/ProcessNewEpoch op earlier in the current block created it, but
the block hasn’t been saved yet so the NewCommittee event isn’t persisted (and
we deliberately don’t populate the shared cache from an unconfirmed block) — fall
back to reading the chain’s own committees view, where the new committee sits as
a pending update.
Sourcepub async fn execute_operation(
&mut self,
context: OperationContext,
operation: SystemOperation,
txn_tracker: &mut TransactionTracker,
resource_controller: &mut ResourceController<Option<AccountOwner>>,
) -> Result<Option<(ApplicationId, Vec<u8>)>, ExecutionError>
pub async fn execute_operation( &mut self, context: OperationContext, operation: SystemOperation, txn_tracker: &mut TransactionTracker, resource_controller: &mut ResourceController<Option<AccountOwner>>, ) -> Result<Option<(ApplicationId, Vec<u8>)>, ExecutionError>
Executes the sender’s side of an operation and returns a list of actions to be taken.
pub async fn transfer( &mut self, authenticated_signer: Option<AccountOwner>, authenticated_application_id: Option<ApplicationId>, source: AccountOwner, recipient: Account, amount: Amount, ) -> Result<Option<OutgoingMessage>, ExecutionError>
pub async fn claim( &mut self, authenticated_signer: Option<AccountOwner>, authenticated_application_id: Option<ApplicationId>, source: AccountOwner, target_id: ChainId, recipient: Account, amount: Amount, ) -> Result<Option<OutgoingMessage>, ExecutionError>
Sourcepub async fn execute_message(
&mut self,
context: MessageContext,
message: SystemMessage,
) -> Result<Vec<OutgoingMessage>, ExecutionError>
pub async fn execute_message( &mut self, context: MessageContext, message: SystemMessage, ) -> Result<Vec<OutgoingMessage>, ExecutionError>
Executes a cross-chain message that represents the recipient’s side of an operation.
Sourcepub async fn initialize_chain(
&mut self,
chain_id: ChainId,
) -> Result<bool, ExecutionError>
pub async fn initialize_chain( &mut self, chain_id: ChainId, ) -> Result<bool, ExecutionError>
Initializes the system application state on a newly opened chain.
Returns Ok(true) if the chain was already initialized, Ok(false) if it wasn’t.
pub fn handle_query( &mut self, context: QueryContext, _query: SystemQuery, ) -> Result<QueryOutcome<SystemResponse>, ExecutionError>
Sourcepub async fn open_chain(
&mut self,
config: OpenChainConfig,
parent: ChainId,
block_height: BlockHeight,
timestamp: Timestamp,
txn_tracker: &mut TransactionTracker,
) -> Result<ChainId, ExecutionError>
pub async fn open_chain( &mut self, config: OpenChainConfig, parent: ChainId, block_height: BlockHeight, timestamp: Timestamp, txn_tracker: &mut TransactionTracker, ) -> Result<ChainId, ExecutionError>
Returns the messages to open a new chain, and subtracts the new chain’s balance from this chain’s.
pub fn close_chain(&mut self) -> Result<(), ExecutionError>
pub async fn create_application( &mut self, chain_id: ChainId, block_height: BlockHeight, module_id: ModuleId, parameters: Vec<u8>, required_application_ids: Vec<ApplicationId>, txn_tracker: &mut TransactionTracker, ) -> Result<CreateApplicationResult, ExecutionError>
Sourcepub async fn describe_application(
&mut self,
id: ApplicationId,
txn_tracker: &mut TransactionTracker,
) -> Result<ApplicationDescription, ExecutionError>
pub async fn describe_application( &mut self, id: ApplicationId, txn_tracker: &mut TransactionTracker, ) -> Result<ApplicationDescription, ExecutionError>
Retrieves an application’s description.
Sourcepub async fn find_dependencies(
&mut self,
stack: Vec<ApplicationId>,
txn_tracker: &mut TransactionTracker,
) -> Result<Vec<ApplicationId>, ExecutionError>
pub async fn find_dependencies( &mut self, stack: Vec<ApplicationId>, txn_tracker: &mut TransactionTracker, ) -> Result<Vec<ApplicationId>, ExecutionError>
Retrieves the recursive dependencies of applications and applies a topological sort.
pub async fn read_blob_content( &self, blob_id: BlobId, ) -> Result<BlobContent, ExecutionError>
pub async fn assert_blob_exists( &mut self, blob_id: BlobId, ) -> Result<(), ExecutionError>
Trait Implementations§
Source§impl<C> Allocative for SystemExecutionStateView<C>
impl<C> Allocative for SystemExecutionStateView<C>
Source§impl<C> ClonableView for SystemExecutionStateView<C>where
HashedLazyRegisterView<C, Option<ChainDescription>>: ClonableView,
HashedRegisterView<C, Epoch>: ClonableView,
HashedRegisterView<C, Option<ChainId>>: ClonableView,
HashedLazyRegisterView<C, BTreeMap<Epoch, Committee>>: ClonableView,
HashedLazyRegisterView<C, ChainOwnership>: ClonableView,
HashedRegisterView<C, Amount>: ClonableView,
HashedMapView<C, AccountOwner, Amount>: ClonableView,
HashedRegisterView<C, Timestamp>: ClonableView,
HashedRegisterView<C, bool>: ClonableView,
HashedLazyRegisterView<C, ApplicationPermissions>: ClonableView,
HashedSetView<C, BlobId>: ClonableView,
HashedMapView<C, (ChainId, StreamId), EventSubscriptions>: ClonableView,
Self: View,
impl<C> ClonableView for SystemExecutionStateView<C>where
HashedLazyRegisterView<C, Option<ChainDescription>>: ClonableView,
HashedRegisterView<C, Epoch>: ClonableView,
HashedRegisterView<C, Option<ChainId>>: ClonableView,
HashedLazyRegisterView<C, BTreeMap<Epoch, Committee>>: ClonableView,
HashedLazyRegisterView<C, ChainOwnership>: ClonableView,
HashedRegisterView<C, Amount>: ClonableView,
HashedMapView<C, AccountOwner, Amount>: ClonableView,
HashedRegisterView<C, Timestamp>: ClonableView,
HashedRegisterView<C, bool>: ClonableView,
HashedLazyRegisterView<C, ApplicationPermissions>: ClonableView,
HashedSetView<C, BlobId>: ClonableView,
HashedMapView<C, (ChainId, StreamId), EventSubscriptions>: ClonableView,
Self: View,
Source§fn clone_unchecked(&mut self) -> Result<Self, ViewError>
fn clone_unchecked(&mut self) -> Result<Self, ViewError>
Source§impl<C: Send + Sync + Context> ContainerType for SystemExecutionStateView<C>
impl<C: Send + Sync + Context> ContainerType for SystemExecutionStateView<C>
Source§async fn resolve_field(&self, ctx: &Context<'_>) -> ServerResult<Option<Value>>
async fn resolve_field(&self, ctx: &Context<'_>) -> ServerResult<Option<Value>>
async_graphql::Value. Read moreSource§async fn find_entity(
&self,
ctx: &Context<'_>,
params: &Value,
) -> ServerResult<Option<Value>>
async fn find_entity( &self, ctx: &Context<'_>, params: &Value, ) -> ServerResult<Option<Value>>
Source§fn collect_all_fields<'a>(
&'a self,
ctx: &ContextBase<'a, &'a Positioned<SelectionSet>>,
fields: &mut Fields<'a>,
) -> Result<(), ServerError>
fn collect_all_fields<'a>( &'a self, ctx: &ContextBase<'a, &'a Positioned<SelectionSet>>, fields: &mut Fields<'a>, ) -> Result<(), ServerError>
Source§impl<C> Debug for SystemExecutionStateView<C>where
HashedLazyRegisterView<C, Option<ChainDescription>>: Debug,
HashedRegisterView<C, Epoch>: Debug,
HashedRegisterView<C, Option<ChainId>>: Debug,
HashedLazyRegisterView<C, BTreeMap<Epoch, Committee>>: Debug,
HashedLazyRegisterView<C, ChainOwnership>: Debug,
HashedRegisterView<C, Amount>: Debug,
HashedMapView<C, AccountOwner, Amount>: Debug,
HashedRegisterView<C, Timestamp>: Debug,
HashedRegisterView<C, bool>: Debug,
HashedLazyRegisterView<C, ApplicationPermissions>: Debug,
HashedSetView<C, BlobId>: Debug,
HashedMapView<C, (ChainId, StreamId), EventSubscriptions>: Debug,
impl<C> Debug for SystemExecutionStateView<C>where
HashedLazyRegisterView<C, Option<ChainDescription>>: Debug,
HashedRegisterView<C, Epoch>: Debug,
HashedRegisterView<C, Option<ChainId>>: Debug,
HashedLazyRegisterView<C, BTreeMap<Epoch, Committee>>: Debug,
HashedLazyRegisterView<C, ChainOwnership>: Debug,
HashedRegisterView<C, Amount>: Debug,
HashedMapView<C, AccountOwner, Amount>: Debug,
HashedRegisterView<C, Timestamp>: Debug,
HashedRegisterView<C, bool>: Debug,
HashedLazyRegisterView<C, ApplicationPermissions>: Debug,
HashedSetView<C, BlobId>: Debug,
HashedMapView<C, (ChainId, StreamId), EventSubscriptions>: Debug,
Source§impl<C> HashableView for SystemExecutionStateView<C>where
HashedLazyRegisterView<C, Option<ChainDescription>>: HashableView,
HashedRegisterView<C, Epoch>: HashableView,
HashedRegisterView<C, Option<ChainId>>: HashableView,
HashedLazyRegisterView<C, BTreeMap<Epoch, Committee>>: HashableView,
HashedLazyRegisterView<C, ChainOwnership>: HashableView,
HashedRegisterView<C, Amount>: HashableView,
HashedMapView<C, AccountOwner, Amount>: HashableView,
HashedRegisterView<C, Timestamp>: HashableView,
HashedRegisterView<C, bool>: HashableView,
HashedLazyRegisterView<C, ApplicationPermissions>: HashableView,
HashedSetView<C, BlobId>: HashableView,
HashedMapView<C, (ChainId, StreamId), EventSubscriptions>: HashableView,
Self: View,
impl<C> HashableView for SystemExecutionStateView<C>where
HashedLazyRegisterView<C, Option<ChainDescription>>: HashableView,
HashedRegisterView<C, Epoch>: HashableView,
HashedRegisterView<C, Option<ChainId>>: HashableView,
HashedLazyRegisterView<C, BTreeMap<Epoch, Committee>>: HashableView,
HashedLazyRegisterView<C, ChainOwnership>: HashableView,
HashedRegisterView<C, Amount>: HashableView,
HashedMapView<C, AccountOwner, Amount>: HashableView,
HashedRegisterView<C, Timestamp>: HashableView,
HashedRegisterView<C, bool>: HashableView,
HashedLazyRegisterView<C, ApplicationPermissions>: HashableView,
HashedSetView<C, BlobId>: HashableView,
HashedMapView<C, (ChainId, StreamId), EventSubscriptions>: HashableView,
Self: View,
Source§impl<C: Send + Sync + Context> OutputType for SystemExecutionStateView<C>
impl<C: Send + Sync + Context> OutputType for SystemExecutionStateView<C>
Source§fn create_type_info(registry: &mut Registry) -> String
fn create_type_info(registry: &mut Registry) -> String
Source§async fn resolve(
&self,
ctx: &ContextSelectionSet<'_>,
_field: &Positioned<Field>,
) -> ServerResult<Value>
async fn resolve( &self, ctx: &ContextSelectionSet<'_>, _field: &Positioned<Field>, ) -> ServerResult<Value>
async_graphql::Value.Source§fn qualified_type_name() -> String
fn qualified_type_name() -> String
Source§impl<C: Context, C2: Context> ReplaceContext<C2> for SystemExecutionStateView<C>
impl<C: Context, C2: Context> ReplaceContext<C2> for SystemExecutionStateView<C>
Source§impl<C> View for SystemExecutionStateView<C>where
C: Context,
HashedLazyRegisterView<C, Option<ChainDescription>>: View<Context = C>,
HashedRegisterView<C, Epoch>: View<Context = C>,
HashedRegisterView<C, Option<ChainId>>: View<Context = C>,
HashedLazyRegisterView<C, BTreeMap<Epoch, Committee>>: View<Context = C>,
HashedLazyRegisterView<C, ChainOwnership>: View<Context = C>,
HashedRegisterView<C, Amount>: View<Context = C>,
HashedMapView<C, AccountOwner, Amount>: View<Context = C>,
HashedRegisterView<C, Timestamp>: View<Context = C>,
HashedRegisterView<C, bool>: View<Context = C>,
HashedLazyRegisterView<C, ApplicationPermissions>: View<Context = C>,
HashedSetView<C, BlobId>: View<Context = C>,
HashedMapView<C, (ChainId, StreamId), EventSubscriptions>: View<Context = C>,
impl<C> View for SystemExecutionStateView<C>where
C: Context,
HashedLazyRegisterView<C, Option<ChainDescription>>: View<Context = C>,
HashedRegisterView<C, Epoch>: View<Context = C>,
HashedRegisterView<C, Option<ChainId>>: View<Context = C>,
HashedLazyRegisterView<C, BTreeMap<Epoch, Committee>>: View<Context = C>,
HashedLazyRegisterView<C, ChainOwnership>: View<Context = C>,
HashedRegisterView<C, Amount>: View<Context = C>,
HashedMapView<C, AccountOwner, Amount>: View<Context = C>,
HashedRegisterView<C, Timestamp>: View<Context = C>,
HashedRegisterView<C, bool>: View<Context = C>,
HashedLazyRegisterView<C, ApplicationPermissions>: View<Context = C>,
HashedSetView<C, BlobId>: View<Context = C>,
HashedMapView<C, (ChainId, StreamId), EventSubscriptions>: View<Context = C>,
Source§const NUM_INIT_KEYS: usize
const NUM_INIT_KEYS: usize
Source§fn pre_load(context: &C) -> Result<Vec<Vec<u8>>, ViewError>
fn pre_load(context: &C) -> Result<Vec<Vec<u8>>, ViewError>
Source§fn post_load(context: C, values: &[Option<Vec<u8>>]) -> Result<Self, ViewError>
fn post_load(context: C, values: &[Option<Vec<u8>>]) -> Result<Self, ViewError>
Source§fn rollback(&mut self)
fn rollback(&mut self)
flush should have no effect to storage.Source§async fn has_pending_changes(&self) -> bool
async fn has_pending_changes(&self) -> bool
true if flushing this view would result in changes to the persistent storage.Source§fn pre_save(&self, batch: &mut Batch) -> Result<bool, ViewError>
fn pre_save(&self, batch: &mut Batch) -> Result<bool, ViewError>
batch variable.
The returned boolean indicates whether the operation removes the view or not.Source§fn post_save(&mut self)
fn post_save(&mut self)
pre_save and after the batch has been successfully written to storage.
This leaves the view in a clean state with no pending changes. Read moreimpl<C: Send + Sync + Context> ObjectType for SystemExecutionStateView<C>
Auto Trait Implementations§
impl<C> !Freeze for SystemExecutionStateView<C>
impl<C> RefUnwindSafe for SystemExecutionStateView<C>where
C: RefUnwindSafe,
impl<C> Send for SystemExecutionStateView<C>where
C: Send,
impl<C> Sync for SystemExecutionStateView<C>where
C: Sync,
impl<C> Unpin for SystemExecutionStateView<C>where
C: Unpin,
impl<C> UnsafeUnpin for SystemExecutionStateView<C>where
C: UnsafeUnpin,
impl<C> UnwindSafe for SystemExecutionStateView<C>where
C: UnwindSafe,
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
Source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<M, I> RuntimeMemory<&mut I> for Mwhere
M: RuntimeMemory<I>,
impl<M, I> RuntimeMemory<&mut I> for Mwhere
M: RuntimeMemory<I>,
Source§fn read<'instance>(
&self,
instance: &'instance &mut I,
location: GuestPointer,
length: u32,
) -> Result<Cow<'instance, [u8]>, RuntimeError>
fn read<'instance>( &self, instance: &'instance &mut I, location: GuestPointer, length: u32, ) -> Result<Cow<'instance, [u8]>, RuntimeError>
Reads length bytes from memory from the provided location.
Source§fn write(
&mut self,
instance: &mut &mut I,
location: GuestPointer,
bytes: &[u8],
) -> Result<(), RuntimeError>
fn write( &mut self, instance: &mut &mut I, location: GuestPointer, bytes: &[u8], ) -> Result<(), RuntimeError>
Writes the bytes to memory at the provided location.