Struct linera_execution::ResourceController
source · pub struct ResourceController<Account = Amount, Tracker = ResourceTracker> {
pub policy: Arc<ResourceControlPolicy>,
pub tracker: Tracker,
pub account: Account,
}Fields§
§policy: Arc<ResourceControlPolicy>The (fixed) policy used to charge fees and control resource usage.
tracker: TrackerHow the resources were used so far.
account: AccountThe account paying for the resource usage.
Implementations§
source§impl<Account, Tracker> ResourceController<Account, Tracker>where
Account: BalanceHolder,
Tracker: AsMut<ResourceTracker>,
impl<Account, Tracker> ResourceController<Account, Tracker>where
Account: BalanceHolder,
Tracker: AsMut<ResourceTracker>,
sourcepub fn merge_balance(
&mut self,
initial: Amount,
other: Amount
) -> Result<(), ExecutionError>
pub fn merge_balance( &mut self, initial: Amount, other: Amount ) -> Result<(), ExecutionError>
Operates a 3-way merge by transferring the difference between initial
and other to self.
sourcepub fn track_block(&mut self) -> Result<(), ExecutionError>
pub fn track_block(&mut self) -> Result<(), ExecutionError>
Tracks the creation of a block.
sourcepub fn track_operation(
&mut self,
operation: &Operation
) -> Result<(), ExecutionError>
pub fn track_operation( &mut self, operation: &Operation ) -> Result<(), ExecutionError>
Tracks the execution of an operation in block.
sourcepub fn track_message(&mut self, message: &Message) -> Result<(), ExecutionError>
pub fn track_message(&mut self, message: &Message) -> Result<(), ExecutionError>
Tracks the creation of an outgoing message.
source§impl ResourceController<Option<Owner>, ResourceTracker>
impl ResourceController<Option<Owner>, ResourceTracker>
sourcepub async fn with<'a, C>(
&mut self,
view: &'a mut ExecutionStateView<C>
) -> Result<ResourceController<OwnedView<'a, C>, &mut ResourceTracker>, ViewError>
pub async fn with<'a, C>( &mut self, view: &'a mut ExecutionStateView<C> ) -> Result<ResourceController<OwnedView<'a, C>, &mut ResourceTracker>, ViewError>
Provides a reference to the current execution state and obtains a temporary object
where the accounting functions of ResourceController are available.
Trait Implementations§
source§impl<Account: Clone, Tracker: Clone> Clone for ResourceController<Account, Tracker>
impl<Account: Clone, Tracker: Clone> Clone for ResourceController<Account, Tracker>
source§fn clone(&self) -> ResourceController<Account, Tracker>
fn clone(&self) -> ResourceController<Account, Tracker>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl<Account, Tracker> Debug for ResourceController<Account, Tracker>
impl<Account, Tracker> Debug for ResourceController<Account, Tracker>
Auto Trait Implementations§
impl<Account, Tracker> RefUnwindSafe for ResourceController<Account, Tracker>where
Account: RefUnwindSafe,
Tracker: RefUnwindSafe,
impl<Account, Tracker> Send for ResourceController<Account, Tracker>
impl<Account, Tracker> Sync for ResourceController<Account, Tracker>
impl<Account, Tracker> Unpin for ResourceController<Account, Tracker>
impl<Account, Tracker> UnwindSafe for ResourceController<Account, Tracker>where
Account: UnwindSafe,
Tracker: UnwindSafe,
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>
Deserializes using the given deserializer
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>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Upcastable for T
impl<T> Upcastable for T
§fn upcast_any_ref(&self) -> &(dyn Any + 'static)
fn upcast_any_ref(&self) -> &(dyn Any + 'static)
upcast ref
§fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
upcast mut ref
§fn upcast_any_box(self: Box<T>) -> Box<dyn Any>
fn upcast_any_box(self: Box<T>) -> Box<dyn Any>
upcast boxed dyn