pub trait SidevmOperation: ContractEnv {
    type deployOutput: ImpliesReturn<Result<(), DriverError>>;
    type canDeployOutput: ImpliesReturn<bool>;
    type deployToWorkersOutput: ImpliesReturn<Result<(), DriverError>>;
    type calcPriceOutput: ImpliesReturn<Result<Balance, DriverError>>;
    type updateDeadlineOutput: ImpliesReturn<Result<(), DriverError>>;
    type deadlineOfOutput: ImpliesReturn<Option<u32>>;

    // Required methods
    fn deploy(&self, code_hash: Hash) -> Self::deployOutput;
    fn can_deploy(&self, contract_id: AccountId) -> Self::canDeployOutput;
    fn deploy_to_workers(
        &mut self,
        code_hash: Hash,
        code_size: u32,
        workers: Vec<WorkerId>,
        max_memory_pages: u32,
        blocks_to_live: u32
    ) -> Self::deployToWorkersOutput;
    fn calc_price(
        &self,
        code_size: u32,
        max_memory_pages: u32,
        n_workers: u32
    ) -> Self::calcPriceOutput;
    fn update_deadline(&mut self, deadline: u32) -> Self::updateDeadlineOutput;
    fn deadline_of(&self, account: AccountId) -> Self::deadlineOfOutput;
}
Expand description

The doc is messed up by the ink macro. See SidevmOperationForDoc for a clean version

Driver to manage sidevm deployments.

Required Associated Types§

source

type deployOutput: ImpliesReturn<Result<(), DriverError>>

Output type of the respective trait message.

source

type canDeployOutput: ImpliesReturn<bool>

Output type of the respective trait message.

source

type deployToWorkersOutput: ImpliesReturn<Result<(), DriverError>>

Output type of the respective trait message.

source

type calcPriceOutput: ImpliesReturn<Result<Balance, DriverError>>

Output type of the respective trait message.

source

type updateDeadlineOutput: ImpliesReturn<Result<(), DriverError>>

Output type of the respective trait message.

source

type deadlineOfOutput: ImpliesReturn<Option<u32>>

Output type of the respective trait message.

Required Methods§

source

fn deploy(&self, code_hash: Hash) -> Self::deployOutput

Invoked by a contract to deploy a sidevm instance that attached to itself.

source

fn can_deploy(&self, contract_id: AccountId) -> Self::canDeployOutput

Check if given address has the permission to deploy a sidevm.

source

fn deploy_to_workers( &mut self, code_hash: Hash, code_size: u32, workers: Vec<WorkerId>, max_memory_pages: u32, blocks_to_live: u32 ) -> Self::deployToWorkersOutput

Deploys a paid side VM instance to a set of worker nodes with the specified configurations.

§Parameters
  • code_hash: The hash of the code to be deployed.
  • code_size: Size of the code.
  • workers: A vector of worker IDs to which the code will be deployed.
  • max_memory_pages: Maximum memory pages allowed for the side VM.
  • blocks_to_live: How many blocks the deployment will live.
§Returns
  • Ok(()) if the deployment was commited.
  • Various Err variants for different types of failures.
source

fn calc_price( &self, code_size: u32, max_memory_pages: u32, n_workers: u32 ) -> Self::calcPriceOutput

Calculates the price for deploying a paid side VM.

§Parameters
  • code_size: Size of the code.
  • max_memory_pages: Maximum memory pages.
  • n_workers: Number of worker nodes.
§Returns
  • Result<Balance> representing the price of the deployment.
source

fn update_deadline(&mut self, deadline: u32) -> Self::updateDeadlineOutput

Updates the deadline for a previously deployed side VM.

§Parameters
  • deadline: The new deadline (in blocks) for the side VM.
§Returns
  • Ok(()) if the update was successful.
  • Err variants for different types of failures.
source

fn deadline_of(&self, account: AccountId) -> Self::deadlineOfOutput

Retrieves the deadline (in blocks) for the deployed side VM of a given account.

§Parameters
  • account: The account ID to query.
§Returns
  • Some(u32) containing the deadline if found.
  • None if the account has not deployed a side VM.

Implementations on Foreign Types§

source§

impl<E> SidevmOperation for TraitDefinitionRegistry<E>
where E: Environment,

source§

fn deploy(&self, __ink_binding_0: Hash) -> Self::deployOutput

Invoked by a contract to deploy a sidevm instance that attached to itself.

source§

fn can_deploy(&self, __ink_binding_0: AccountId) -> Self::canDeployOutput

Check if given address has the permission to deploy a sidevm.

source§

fn deploy_to_workers( &mut self, __ink_binding_0: Hash, __ink_binding_1: u32, __ink_binding_2: Vec<WorkerId>, __ink_binding_3: u32, __ink_binding_4: u32 ) -> Self::deployToWorkersOutput

Deploys a paid side VM instance to a set of worker nodes with the specified configurations.

§Parameters
  • code_hash: The hash of the code to be deployed.
  • code_size: Size of the code.
  • workers: A vector of worker IDs to which the code will be deployed.
  • max_memory_pages: Maximum memory pages allowed for the side VM.
  • blocks_to_live: How many blocks the deployment will live.
§Returns
  • Ok(()) if the deployment was commited.
  • Various Err variants for different types of failures.
source§

fn calc_price( &self, __ink_binding_0: u32, __ink_binding_1: u32, __ink_binding_2: u32 ) -> Self::calcPriceOutput

Calculates the price for deploying a paid side VM.

§Parameters
  • code_size: Size of the code.
  • max_memory_pages: Maximum memory pages.
  • n_workers: Number of worker nodes.
§Returns
  • Result<Balance> representing the price of the deployment.
source§

fn update_deadline( &mut self, __ink_binding_0: u32 ) -> Self::updateDeadlineOutput

Updates the deadline for a previously deployed side VM.

§Parameters
  • deadline: The new deadline (in blocks) for the side VM.
§Returns
  • Ok(()) if the update was successful.
  • Err variants for different types of failures.
source§

fn deadline_of(&self, __ink_binding_0: AccountId) -> Self::deadlineOfOutput

Retrieves the deadline (in blocks) for the deployed side VM of a given account.

§Parameters
  • account: The account ID to query.
§Returns
  • Some(u32) containing the deadline if found.
  • None if the account has not deployed a side VM.
§

type deployOutput = Result<(), DriverError>

§

type canDeployOutput = bool

§

type deployToWorkersOutput = Result<(), DriverError>

§

type calcPriceOutput = Result<<PinkEnvironment as Environment>::Balance, DriverError>

§

type updateDeadlineOutput = Result<(), DriverError>

§

type deadlineOfOutput = Option<u32>

Implementors§