pub struct V8RuntimeHost { /* private fields */ }Expand description
Manages an embedded V8 runtime with session multiplexing.
Implementations§
Source§impl V8RuntimeHost
impl V8RuntimeHost
Sourcepub fn register_session(
&self,
session_id: &str,
) -> Result<TrackedReceiver<BinaryFrame>>
pub fn register_session( &self, session_id: &str, ) -> Result<TrackedReceiver<BinaryFrame>>
Register a session and return a receiver for its frames.
Sourcepub fn unregister_session(&self, session_id: &str)
pub fn unregister_session(&self, session_id: &str)
Unregister a session.
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<()>
pub fn create_session_from_command(&self, command: RuntimeCommand) -> Result<()>
Sourcepub fn send_frame(&self, frame: &BinaryFrame) -> Result<()>
pub fn send_frame(&self, frame: &BinaryFrame) -> Result<()>
Send a frame to the V8 runtime.
Sourcepub fn bridge_code() -> &'static str
pub fn bridge_code() -> &'static str
Get the pre-bundled bridge code (polyfills).
Sourcepub fn pre_warm_snapshot(&self, userland_code: &str) -> Result<()>
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.
pub fn pre_warm_workers( &self, userland_code: &str, heap_limit_mb: u32, count: usize, )
pub fn seed_default_warm_workers_async(&self)
Sourcepub fn snapshot_ready(&self, userland_code: &str) -> bool
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.
Sourcepub fn warm_snapshot_async(userland_code: String)
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.
Sourcepub fn session_handle(&self, session_id: String) -> V8SessionHandle
pub fn session_handle(&self, session_id: String) -> V8SessionHandle
Create a session handle for sending session-scoped frames and cleanup.