pub struct SystemExecutionStateView<C> {
pub description: HashedRegisterView<C, Option<ChainDescription>>,
pub epoch: HashedRegisterView<C, Option<Epoch>>,
pub admin_id: HashedRegisterView<C, Option<ChainId>>,
pub committees: HashedRegisterView<C, BTreeMap<Epoch, Committee>>,
pub ownership: HashedRegisterView<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: HashedRegisterView<C, ApplicationPermissions>,
pub used_blobs: HashedSetView<C, BlobId>,
pub event_subscriptions: MapView<C, (ChainId, StreamId), EventSubscriptions>,
}
Expand description
A view accessing the execution state of the system of a chain.
Fields§
§description: HashedRegisterView<C, Option<ChainDescription>>
How the chain was created. May be unknown for inactive chains.
epoch: HashedRegisterView<C, Option<Epoch>>
The number identifying the current configuration.
admin_id: HashedRegisterView<C, Option<ChainId>>
The admin of the chain.
committees: HashedRegisterView<C, BTreeMap<Epoch, Committee>>
The committees that we trust, indexed by epoch number.
ownership: HashedRegisterView<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: HashedRegisterView<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: MapView<C, (ChainId, StreamId), EventSubscriptions>
The event stream subscriptions of applications on this chain.
Implementations§
Source§impl<C> SystemExecutionStateView<C>
impl<C> SystemExecutionStateView<C>
Sourcepub fn current_committee(&self) -> Option<(Epoch, &Committee)>
pub fn current_committee(&self) -> Option<(Epoch, &Committee)>
Returns the current committee, if any.
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: Recipient, amount: Amount, ) -> Result<Option<OutgoingMessage>, ExecutionError>
pub async fn claim( &self, authenticated_signer: Option<AccountOwner>, authenticated_application_id: Option<ApplicationId>, source: AccountOwner, target_id: ChainId, recipient: Recipient, amount: Amount, ) -> Result<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 fn initialize_chain(
&mut self,
message_id: MessageId,
timestamp: Timestamp,
config: OpenChainConfig,
)
pub fn initialize_chain( &mut self, message_id: MessageId, timestamp: Timestamp, config: OpenChainConfig, )
Initializes the system application state on a newly opened chain.
pub async fn handle_query( &mut self, context: QueryContext, _query: SystemQuery, ) -> Result<QueryOutcome<SystemResponse>, ExecutionError>
Sourcepub async fn open_chain(
&mut self,
config: OpenChainConfig,
next_message_id: MessageId,
) -> Result<OutgoingMessage, ExecutionError>
pub async fn open_chain( &mut self, config: OpenChainConfig, next_message_id: MessageId, ) -> Result<OutgoingMessage, ExecutionError>
Returns the messages to open a new chain, and subtracts the new chain’s balance from this chain’s.
pub async 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: TransactionTracker, ) -> Result<CreateApplicationResult, ExecutionError>
Sourcepub async fn describe_application(
&mut self,
id: ApplicationId,
txn_tracker: Option<&mut TransactionTracker>,
) -> Result<ApplicationDescription, ExecutionError>
pub async fn describe_application( &mut self, id: ApplicationId, txn_tracker: Option<&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> ClonableView<C> for SystemExecutionStateView<C>
impl<C> ClonableView<C> for SystemExecutionStateView<C>
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
HashedRegisterView<C, Option<ChainDescription>>: Debug,
HashedRegisterView<C, Option<Epoch>>: Debug,
HashedRegisterView<C, Option<ChainId>>: Debug,
HashedRegisterView<C, BTreeMap<Epoch, Committee>>: Debug,
HashedRegisterView<C, ChainOwnership>: Debug,
HashedRegisterView<C, Amount>: Debug,
HashedMapView<C, AccountOwner, Amount>: Debug,
HashedRegisterView<C, Timestamp>: Debug,
HashedRegisterView<C, bool>: Debug,
HashedRegisterView<C, ApplicationPermissions>: Debug,
HashedSetView<C, BlobId>: Debug,
MapView<C, (ChainId, StreamId), EventSubscriptions>: Debug,
impl<C> Debug for SystemExecutionStateView<C>where
HashedRegisterView<C, Option<ChainDescription>>: Debug,
HashedRegisterView<C, Option<Epoch>>: Debug,
HashedRegisterView<C, Option<ChainId>>: Debug,
HashedRegisterView<C, BTreeMap<Epoch, Committee>>: Debug,
HashedRegisterView<C, ChainOwnership>: Debug,
HashedRegisterView<C, Amount>: Debug,
HashedMapView<C, AccountOwner, Amount>: Debug,
HashedRegisterView<C, Timestamp>: Debug,
HashedRegisterView<C, bool>: Debug,
HashedRegisterView<C, ApplicationPermissions>: Debug,
HashedSetView<C, BlobId>: Debug,
MapView<C, (ChainId, StreamId), EventSubscriptions>: Debug,
Source§impl<C> HashableView<C> for SystemExecutionStateView<C>
impl<C> HashableView<C> for SystemExecutionStateView<C>
Source§type Hasher = CoreWrapper<Sha3_256Core>
type Hasher = CoreWrapper<Sha3_256Core>
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> View<C> for SystemExecutionStateView<C>
impl<C> View<C> for SystemExecutionStateView<C>
Source§const NUM_INIT_KEYS: usize = 20usize
const NUM_INIT_KEYS: usize = 20usize
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 load<'async_trait>(
context: C,
) -> Pin<Box<dyn Future<Output = Result<Self, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
fn load<'async_trait>(
context: C,
) -> Pin<Box<dyn Future<Output = Result<Self, ViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
Source§fn rollback(&mut self)
fn rollback(&mut self)
flush
should have no effect to storage.Source§fn has_pending_changes<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn has_pending_changes<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
true
if flushing this view would result in changes to the persistent storage.Source§fn flush(&mut self, batch: &mut Batch) -> Result<bool, ViewError>
fn flush(&mut self, batch: &mut Batch) -> Result<bool, ViewError>
batch
variable first. If the view is dropped without calling flush
, staged
changes are simply lost.
The returned boolean indicates whether the operation removes the view or not.impl<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> 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> 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
.