pub struct ApplicationRegistryView<C> {
pub known_applications: HashedMapView<C, UserApplicationId, UserApplicationDescription>,
}
Fields§
§known_applications: HashedMapView<C, UserApplicationId, UserApplicationDescription>
The applications that are known by the chain.
Implementations§
Source§impl<C> ApplicationRegistryView<C>
impl<C> ApplicationRegistryView<C>
Sourcepub async fn register_application(
&mut self,
application: UserApplicationDescription,
) -> Result<UserApplicationId, SystemExecutionError>
pub async fn register_application( &mut self, application: UserApplicationDescription, ) -> Result<UserApplicationId, SystemExecutionError>
Registers an existing application.
Keeps track of an existing application that the current chain is seeing for the first time.
Sourcepub async fn register_new_application(
&mut self,
application_id: UserApplicationId,
parameters: Vec<u8>,
required_application_ids: Vec<UserApplicationId>,
) -> Result<(), SystemExecutionError>
pub async fn register_new_application( &mut self, application_id: UserApplicationId, parameters: Vec<u8>, required_application_ids: Vec<UserApplicationId>, ) -> Result<(), SystemExecutionError>
Registers a newly created application.
Sourcepub async fn describe_application(
&self,
id: UserApplicationId,
) -> Result<UserApplicationDescription, SystemExecutionError>
pub async fn describe_application( &self, id: UserApplicationId, ) -> Result<UserApplicationDescription, SystemExecutionError>
Retrieves an application’s description.
Sourcepub async fn find_dependencies(
&self,
stack: Vec<UserApplicationId>,
registered_apps: &HashMap<UserApplicationId, UserApplicationDescription>,
) -> Result<Vec<UserApplicationId>, SystemExecutionError>
pub async fn find_dependencies( &self, stack: Vec<UserApplicationId>, registered_apps: &HashMap<UserApplicationId, UserApplicationDescription>, ) -> Result<Vec<UserApplicationId>, SystemExecutionError>
Retrieves the recursive dependencies of applications and apply a topological sort.
Sourcepub async fn describe_applications_with_dependencies(
&self,
ids: Vec<UserApplicationId>,
extra_registered_apps: &HashMap<UserApplicationId, UserApplicationDescription>,
) -> Result<Vec<UserApplicationDescription>, SystemExecutionError>
pub async fn describe_applications_with_dependencies( &self, ids: Vec<UserApplicationId>, extra_registered_apps: &HashMap<UserApplicationId, UserApplicationDescription>, ) -> Result<Vec<UserApplicationDescription>, SystemExecutionError>
Retrieves applications’ descriptions preceded by their recursive dependencies.
Trait Implementations§
Source§impl<C> ClonableView<C> for ApplicationRegistryView<C>
impl<C> ClonableView<C> for ApplicationRegistryView<C>
Source§fn clone_unchecked(&mut self) -> Result<Self, ViewError>
fn clone_unchecked(&mut self) -> Result<Self, ViewError>
Creates a clone of this view, sharing the underlying storage context but prone to
data races which can corrupt the view state.
Source§impl<C: Debug> Debug for ApplicationRegistryView<C>
impl<C: Debug> Debug for ApplicationRegistryView<C>
Source§impl<C> HashableView<C> for ApplicationRegistryView<C>
impl<C> HashableView<C> for ApplicationRegistryView<C>
Source§type Hasher = CoreWrapper<Sha3_256Core>
type Hasher = CoreWrapper<Sha3_256Core>
How to compute hashes.
Source§impl<C> View<C> for ApplicationRegistryView<C>
impl<C> View<C> for ApplicationRegistryView<C>
Source§const NUM_INIT_KEYS: usize = 1usize
const NUM_INIT_KEYS: usize = 1usize
The number of keys used for the initialization
Source§fn pre_load(context: &C) -> Result<Vec<Vec<u8>>, ViewError>
fn pre_load(context: &C) -> Result<Vec<Vec<u8>>, ViewError>
Creates the keys needed for loading the view
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>
Loads a view from the values
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,
Loads a view
Source§fn rollback(&mut self)
fn rollback(&mut self)
Discards all pending changes. After that
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,
Returns
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>
Persists changes to storage. This leaves the view still usable and is essentially neutral to the
program running. Crash-resistant storage implementations are expected to accumulate the desired
changes in the
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.Auto Trait Implementations§
impl<C> !Freeze for ApplicationRegistryView<C>
impl<C> RefUnwindSafe for ApplicationRegistryView<C>where
C: RefUnwindSafe,
impl<C> Send for ApplicationRegistryView<C>where
C: Send,
impl<C> Sync for ApplicationRegistryView<C>where
C: Sync,
impl<C> Unpin for ApplicationRegistryView<C>where
C: Unpin,
impl<C> UnwindSafe for ApplicationRegistryView<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
Mutably borrows from an owned value. Read more
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>
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 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>
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 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
.