pub struct InstanceVm { /* private fields */ }
Expand description
The instantiated Vm for the Instance use-case.
Implementations§
Source§impl InstanceVm
impl InstanceVm
Sourcepub fn new(
node_config_path: impl Into<PathBuf>,
app_id: AppId,
proxy: Arc<ProxyClient>,
) -> Self
pub fn new( node_config_path: impl Into<PathBuf>, app_id: AppId, proxy: Arc<ProxyClient>, ) -> Self
Constructor for the InstanceVm.
§Arguments
node_config_path
: The path to the configuration for this node’s environment. For us, contains the path to the infra.yml and (optional) secrets.yml files.app_id
: The application ID for this session.proxy
: The ProxyClient that we use to connect to/throughbrane-prx
.planner
: The client-side of a planner that we use to plan.
§Returns
A new InstanceVm instance.
Sourcepub async fn exec(
self,
tx: Sender<Result<ExecuteReply, Status>>,
id: AppId,
workflow: Workflow,
prof: ProfileScopeHandle<'_>,
) -> (Self, Result<FullValue, Error>)
pub async fn exec( self, tx: Sender<Result<ExecuteReply, Status>>, id: AppId, workflow: Workflow, prof: ProfileScopeHandle<'_>, ) -> (Self, Result<FullValue, Error>)
Runs the given workflow on this VM.
There is a bit of ownership awkwardness going on, but that’s due to the need for the struct to outlive threads.
§Arguments
tx
: The transmission channel to send feedback to the client on.id
: The identifier of the workflow this session is part of.workflow
: The Workflow to execute.prof
: The ProfileScope that can be used to provide additional information about the timings of the VM.
§Returns
The result of the workflow, if any. It also returns self
again for subsequent runs.
Trait Implementations§
Source§impl Clone for InstanceVm
impl Clone for InstanceVm
Source§fn clone(&self) -> InstanceVm
fn clone(&self) -> InstanceVm
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 Vm for InstanceVm
impl Vm for InstanceVm
Source§type GlobalState = GlobalState
type GlobalState = GlobalState
The type of the thread-global extension to the runtime state.
Source§type LocalState = ()
type LocalState = ()
The type of the thread-local extension to the runtime state.
Source§fn store_state(
this: &Arc<RwLock<Self>>,
state: RunState<Self::GlobalState>,
) -> Result<(), VmError>
fn store_state( this: &Arc<RwLock<Self>>, state: RunState<Self::GlobalState>, ) -> Result<(), VmError>
A function that stores the given runtime state information in the parent struct. Read more
Source§fn load_state(
this: &Arc<RwLock<Self>>,
) -> Result<RunState<Self::GlobalState>, VmError>
fn load_state( this: &Arc<RwLock<Self>>, ) -> Result<RunState<Self::GlobalState>, VmError>
A function that returns the VM’s runtime state in the parent struct. Read more
Source§fn new_state(custom: Self::GlobalState) -> RunState<Self::GlobalState>
fn new_state(custom: Self::GlobalState) -> RunState<Self::GlobalState>
Initializes a new global state based on the given custom part. Read more
Source§fn run<'life0, 'async_trait, P>(
this: Arc<RwLock<Self>>,
snippet: Workflow,
prof: ProfileScopeHandle<'life0>,
) -> Pin<Box<dyn Future<Output = Result<FullValue, VmError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + Send + 'async_trait,
P: 'async_trait + VmPlugin<GlobalState = Self::GlobalState, LocalState = Self::LocalState>,
fn run<'life0, 'async_trait, P>(
this: Arc<RwLock<Self>>,
snippet: Workflow,
prof: ProfileScopeHandle<'life0>,
) -> Pin<Box<dyn Future<Output = Result<FullValue, VmError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + Send + 'async_trait,
P: 'async_trait + VmPlugin<GlobalState = Self::GlobalState, LocalState = Self::LocalState>,
Runs the given workflow, possibly asynchronously (if a parallel is encountered / there are external functions calls and the given closure runs this asynchronously.) Read more
Auto Trait Implementations§
impl Freeze for InstanceVm
impl RefUnwindSafe for InstanceVm
impl Send for InstanceVm
impl Sync for InstanceVm
impl Unpin for InstanceVm
impl UnwindSafe for InstanceVm
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request