pub struct Jam { /* private fields */ }Expand description
JAM environment
Implementations§
Source§impl Jam
impl Jam
Sourcepub fn add_account(&mut self, service: ServiceId, account: ServiceAccount)
pub fn add_account(&mut self, service: ServiceId, account: ServiceAccount)
Add a service account
Sourcepub fn add_service(&mut self, service: ServiceId, code: Vec<u8>)
pub fn add_service(&mut self, service: ServiceId, code: Vec<u8>)
Add a service account
Sourcepub fn add_preimage(
&mut self,
service: ServiceId,
preimage: Vec<u8>,
) -> OpaqueHash
pub fn add_preimage( &mut self, service: ServiceId, preimage: Vec<u8>, ) -> OpaqueHash
Add a preimage to the service account
Sourcepub fn get_storage<V: DeserializeOwned>(
&self,
service: ServiceId,
key: &[u8],
) -> Option<V>
pub fn get_storage<V: DeserializeOwned>( &self, service: ServiceId, key: &[u8], ) -> Option<V>
Get a storage of an account
Sourcepub fn set_code(&mut self, service: ServiceId, code: OpaqueHash)
pub fn set_code(&mut self, service: ServiceId, code: OpaqueHash)
Set the code of the service account
Sourcepub fn with_account(self, service: ServiceId, account: ServiceAccount) -> Self
pub fn with_account(self, service: ServiceId, account: ServiceAccount) -> Self
Add a service account
Source§impl Jam
impl Jam
Sourcepub fn execute(
&mut self,
service: ServiceId,
payload: Vec<u8>,
) -> Result<ExecutionInfo>
pub fn execute( &mut self, service: ServiceId, payload: Vec<u8>, ) -> Result<ExecutionInfo>
Execute a work item directly
TODO: introduce better execution result
Authorize the work package
Sourcepub fn refine(&mut self, work: &WorkPackage) -> Result<Vec<WorkResult>>
pub fn refine(&mut self, work: &WorkPackage) -> Result<Vec<WorkResult>>
Refine the work package
NOTE: run refine for all work items
Sourcepub fn accumulate(
&mut self,
results: Vec<WorkResult>,
) -> Result<Vec<Accumulated>>
pub fn accumulate( &mut self, results: Vec<WorkResult>, ) -> Result<Vec<Accumulated>>
Accumulate the work package
- convert work package to work report
- run accumulate for all work items
- return the accumulated result
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Jam
impl RefUnwindSafe for Jam
impl Send for Jam
impl Sync for Jam
impl Unpin for Jam
impl UnwindSafe for Jam
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