brane_drv::vm

Struct InstanceVm

Source
pub struct InstanceVm { /* private fields */ }
Expand description

The instantiated Vm for the Instance use-case.

Implementations§

Source§

impl InstanceVm

Source

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/through brane-prx.
  • planner: The client-side of a planner that we use to plan.
§Returns

A new InstanceVm instance.

Source

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

Source§

fn clone(&self) -> InstanceVm

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Vm for InstanceVm

Source§

type GlobalState = GlobalState

The type of the thread-global extension to the runtime state.
Source§

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>

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>

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>

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>,

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T