Struct linera_execution::system::SystemExecutionStateView
source · pub struct SystemExecutionStateView<C> {Show 13 fields
pub description: HashedRegisterView<C, Option<ChainDescription>>,
pub epoch: HashedRegisterView<C, Option<Epoch>>,
pub admin_id: HashedRegisterView<C, Option<ChainId>>,
pub subscriptions: HashedSetView<C, ChannelSubscription>,
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 registry: ApplicationRegistryView<C>,
pub closed: HashedRegisterView<C, bool>,
pub application_permissions: HashedRegisterView<C, ApplicationPermissions>,
pub used_blobs: HashedSetView<C, BlobId>,
}
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.
subscriptions: HashedSetView<C, ChannelSubscription>
Track the channels that we have subscribed to.
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.
registry: ApplicationRegistryView<C>
Track the locations of known bytecodes as well as the descriptions of known applications.
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.
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,
) -> Result<Option<(UserApplicationId, Vec<u8>)>, SystemExecutionError>
pub async fn execute_operation( &mut self, context: OperationContext, operation: SystemOperation, txn_tracker: &mut TransactionTracker, ) -> Result<Option<(UserApplicationId, Vec<u8>)>, SystemExecutionError>
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<Owner>, authenticated_application_id: Option<UserApplicationId>, source: Option<AccountOwner>, recipient: Recipient, amount: Amount, ) -> Result<Option<RawOutgoingMessage<SystemMessage, Amount>>, SystemExecutionError>
pub async fn claim( &self, authenticated_signer: Option<Owner>, authenticated_application_id: Option<UserApplicationId>, source: AccountOwner, target_id: ChainId, recipient: Recipient, amount: Amount, ) -> Result<RawOutgoingMessage<SystemMessage, Amount>, SystemExecutionError>
sourcepub async fn execute_message(
&mut self,
context: MessageContext,
message: SystemMessage,
txn_tracker: &mut TransactionTracker,
) -> Result<RawExecutionOutcome<SystemMessage, Amount>, SystemExecutionError>
pub async fn execute_message( &mut self, context: MessageContext, message: SystemMessage, txn_tracker: &mut TransactionTracker, ) -> Result<RawExecutionOutcome<SystemMessage, Amount>, SystemExecutionError>
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>, SystemExecutionError>
sourcepub async fn open_chain(
&mut self,
config: OpenChainConfig,
next_message_id: MessageId,
) -> Result<[RawOutgoingMessage<SystemMessage, Amount>; 2], SystemExecutionError>
pub async fn open_chain( &mut self, config: OpenChainConfig, next_message_id: MessageId, ) -> Result<[RawOutgoingMessage<SystemMessage, Amount>; 2], SystemExecutionError>
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, id: ChainId, ) -> Result<Vec<RawOutgoingMessage<SystemMessage, Amount>>, SystemExecutionError>
pub async fn create_application( &mut self, next_message_id: MessageId, bytecode_id: BytecodeId, parameters: Vec<u8>, required_application_ids: Vec<UserApplicationId>, ) -> Result<CreateApplicationResult, SystemExecutionError>
pub async fn read_blob_content( &mut self, blob_id: BlobId, ) -> Result<BlobContent, SystemExecutionError>
pub async fn assert_blob_exists( &mut self, blob_id: BlobId, ) -> Result<(), SystemExecutionError>
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,
HashedSetView<C, ChannelSubscription>: Debug,
HashedRegisterView<C, BTreeMap<Epoch, Committee>>: Debug,
HashedRegisterView<C, ChainOwnership>: Debug,
HashedRegisterView<C, Amount>: Debug,
HashedMapView<C, AccountOwner, Amount>: Debug,
HashedRegisterView<C, Timestamp>: Debug,
ApplicationRegistryView<C>: Debug,
HashedRegisterView<C, bool>: Debug,
HashedRegisterView<C, ApplicationPermissions>: Debug,
HashedSetView<C, BlobId>: Debug,
impl<C> Debug for SystemExecutionStateView<C>where
HashedRegisterView<C, Option<ChainDescription>>: Debug,
HashedRegisterView<C, Option<Epoch>>: Debug,
HashedRegisterView<C, Option<ChainId>>: Debug,
HashedSetView<C, ChannelSubscription>: Debug,
HashedRegisterView<C, BTreeMap<Epoch, Committee>>: Debug,
HashedRegisterView<C, ChainOwnership>: Debug,
HashedRegisterView<C, Amount>: Debug,
HashedMapView<C, AccountOwner, Amount>: Debug,
HashedRegisterView<C, Timestamp>: Debug,
ApplicationRegistryView<C>: Debug,
HashedRegisterView<C, bool>: Debug,
HashedRegisterView<C, ApplicationPermissions>: Debug,
HashedSetView<C, BlobId>: Debug,
source§impl<C> HashableView<C> for SystemExecutionStateView<C>
impl<C> HashableView<C> for SystemExecutionStateView<C>
§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> RegisterMockApplication for SystemExecutionStateView<C>
impl<C> RegisterMockApplication for SystemExecutionStateView<C>
source§fn creator_chain_id(&self) -> ChainId
fn creator_chain_id(&self) -> ChainId
source§async fn registered_application_count(&self) -> Result<usize>
async fn registered_application_count(&self) -> Result<usize>
source§async fn register_mock_application_with(
&mut self,
description: UserApplicationDescription,
contract: Blob,
service: Blob,
) -> Result<(UserApplicationId, MockApplication)>
async fn register_mock_application_with( &mut self, description: UserApplicationDescription, contract: Blob, service: Blob, ) -> Result<(UserApplicationId, MockApplication)>
MockApplication
associated with a UserApplicationDescription
and
its bytecode Blob
s.source§async fn register_mock_application(
&mut self,
) -> Result<(UserApplicationId, MockApplication)>
async fn register_mock_application( &mut self, ) -> Result<(UserApplicationId, MockApplication)>
MockApplication
and returns it with the UserApplicationId
that was
used for it.source§impl<C> View<C> for SystemExecutionStateView<C>
impl<C> View<C> for SystemExecutionStateView<C>
source§const NUM_INIT_KEYS: usize = 22usize
const NUM_INIT_KEYS: usize = 22usize
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> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
source§impl<T> FmtForward for T
impl<T> FmtForward for T
source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.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<T> LayoutRaw for T
impl<T> LayoutRaw for T
source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
source§impl<T> MockResults for T
impl<T> MockResults for T
§type Results = T
type Results = T
MockInstance
.source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.source§impl<T> Pointable for T
impl<T> Pointable for T
source§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
.
source§impl<T> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.