pub trait AccumulateOps {
type Error: Debug;
// Required methods
fn get(&self, id: ServiceId, key: &StorageKey) -> Option<Cow<'_, [u8]>>;
fn set(
&mut self,
key: StorageKey,
value: Cow<'_, [u8]>,
) -> Result<(), Self::Error>;
fn remove(&mut self, key: &StorageKey) -> bool;
fn min_memo_gas(&self, service_id: ServiceId) -> Option<UnsignedGas>;
fn transfer(
&self,
destination: ServiceId,
amount: Balance,
gas_limit: UnsignedGas,
memo: &Memo,
) -> Result<(), Self::Error>;
fn bless<'a>(
&mut self,
manager: ServiceId,
assigner: ServiceId,
designator: ServiceId,
registrar: ServiceId,
always_acc: impl IntoIterator<Item = &'a (ServiceId, UnsignedGas)>,
);
fn zombify(&mut self, ejector: ServiceId);
// Provided methods
fn set_typed(
&mut self,
key: StorageKey,
value: &impl Encode,
) -> Result<(), Self::Error> { ... }
fn get_typed<T: Decode>(
&self,
id: ServiceId,
key: &StorageKey,
) -> Result<Option<T>, Error> { ... }
fn transfer_typed(
&self,
destination: ServiceId,
amount: Balance,
gas_limit: UnsignedGas,
memo: &impl Encode,
) -> Result<(), Self::Error> { ... }
}Expand description
Operations that AccumulateEngine uses during accumulation.
Each operation corresponds to a JAM host-call.
Required Associated Types§
Required Methods§
Sourcefn get(&self, id: ServiceId, key: &StorageKey) -> Option<Cow<'_, [u8]>>
fn get(&self, id: ServiceId, key: &StorageKey) -> Option<Cow<'_, [u8]>>
Read value under the specified key from the storage of the specified service.
Sourcefn set(
&mut self,
key: StorageKey,
value: Cow<'_, [u8]>,
) -> Result<(), Self::Error>
fn set( &mut self, key: StorageKey, value: Cow<'_, [u8]>, ) -> Result<(), Self::Error>
Write value under the specified key to the storage.
Sourcefn remove(&mut self, key: &StorageKey) -> bool
fn remove(&mut self, key: &StorageKey) -> bool
Remove value under the specified key from the storage of the service being accumulated.
Returns true if the value was present in the storage before the removal.
Sourcefn min_memo_gas(&self, service_id: ServiceId) -> Option<UnsignedGas>
fn min_memo_gas(&self, service_id: ServiceId) -> Option<UnsignedGas>
Get min. memo gas of the specified service.
Sourcefn transfer(
&self,
destination: ServiceId,
amount: Balance,
gas_limit: UnsignedGas,
memo: &Memo,
) -> Result<(), Self::Error>
fn transfer( &self, destination: ServiceId, amount: Balance, gas_limit: UnsignedGas, memo: &Memo, ) -> Result<(), Self::Error>
Transfer data and/or funds to another service.
Sourcefn bless<'a>(
&mut self,
manager: ServiceId,
assigner: ServiceId,
designator: ServiceId,
registrar: ServiceId,
always_acc: impl IntoIterator<Item = &'a (ServiceId, UnsignedGas)>,
)
fn bless<'a>( &mut self, manager: ServiceId, assigner: ServiceId, designator: ServiceId, registrar: ServiceId, always_acc: impl IntoIterator<Item = &'a (ServiceId, UnsignedGas)>, )
Reset the privileged services.
Provided Methods§
Sourcefn set_typed(
&mut self,
key: StorageKey,
value: &impl Encode,
) -> Result<(), Self::Error>
fn set_typed( &mut self, key: StorageKey, value: &impl Encode, ) -> Result<(), Self::Error>
Same as set but encodes the provided value using JAM codec.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".