Skip to main content

V8RuntimeHost

Struct V8RuntimeHost 

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

Manages an embedded V8 runtime with session multiplexing.

Implementations§

Source§

impl V8RuntimeHost

Source

pub fn spawn() -> Result<Self>

Connect to the process-global embedded V8 runtime client.

Source

pub fn register_session( &self, session_id: &str, ) -> Result<TrackedReceiver<BinaryFrame>>

Register a session and return a receiver for its frames.

Source

pub fn unregister_session(&self, session_id: &str)

Unregister a session.

Source

pub fn create_session( &self, session_id: String, heap_limit_mb: u32, cpu_time_limit_ms: u32, wall_clock_limit_ms: u32, warm_hint: Option<WarmSessionHint>, ) -> Result<()>

Source

pub fn create_session_from_command(&self, command: RuntimeCommand) -> Result<()>

Source

pub fn send_frame(&self, frame: &BinaryFrame) -> Result<()>

Send a frame to the V8 runtime.

Source

pub fn bridge_code() -> &'static str

Get the pre-bundled bridge code (polyfills).

Source

pub fn pre_warm_snapshot(&self, userland_code: &str) -> Result<()>

Pre-build the per-sidecar snapshot for an agent-SDK userland_code bundle into the process-wide cache, so the FIRST session that uses it is already warm (no cold-build penalty on the session-create path). Blocks until the snapshot is built; idempotent (a cache hit returns immediately). A no-op for empty userland_code.

Source

pub fn pre_warm_workers( &self, userland_code: &str, heap_limit_mb: u32, count: usize, )

Source

pub fn seed_default_warm_workers_async(&self)

Source

pub fn snapshot_ready(&self, userland_code: &str) -> bool

True when the process-wide snapshot cache already has this userland bundle. This is a lookup only; it never creates a snapshot.

Source

pub fn warm_snapshot_async(userland_code: String)

Kick a process-wide async warm for the wasm runner snapshot. At most one warm thread is spawned per process; blocking callers should use pre_warm_snapshot.

Source

pub fn session_handle(&self, session_id: String) -> V8SessionHandle

Create a session handle for sending session-scoped frames and cleanup.

Source

pub fn child_pid(&self) -> u32

Source

pub fn is_alive(&mut self) -> Result<bool>

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<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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<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