pub struct Host(/* private fields */);Expand description
Runs native callbacks on the supplied executor. Keep the executor running until callbacks and cleanup settle.
Implementations§
Source§impl Host
impl Host
Sourcepub fn get_with_options(
&self,
service: &str,
key: Vec<String>,
principal: &str,
options: AcquisitionOptions,
) -> Result<Reference>
pub fn get_with_options( &self, service: &str, key: Vec<String>, principal: &str, options: AcquisitionOptions, ) -> Result<Reference>
Acquire a reference with an explicit API version and allowed method requirement.
Sourcepub async fn get_wait(
&self,
service: &str,
key: Vec<String>,
principal: &str,
options: AcquisitionOptions,
) -> Result<Reference>
pub async fn get_wait( &self, service: &str, key: Vec<String>, principal: &str, options: AcquisitionOptions, ) -> Result<Reference>
Acquire after the exact previous instance has physically closed, repeating admission.
Other refusals return immediately. Dropping this future never cancels the old cleanup.
This waits for address availability; use Reference::ready to await activation.
Source§impl Host
impl Host
Source§impl Host
impl Host
Sourcepub fn spawn_root<T: 'static>(
&self,
principal: &str,
operation: impl FnOnce(Context) -> LocalBoxFuture<'static, Result<T>> + 'static,
) -> Result<Receiver<Result<T>>>
pub fn spawn_root<T: 'static>( &self, principal: &str, operation: impl FnOnce(Context) -> LocalBoxFuture<'static, Result<T>> + 'static, ) -> Result<Receiver<Result<T>>>
Run a root operation as a task of this host instead of the caller’s future.
The root lives until the operation itself completes, whoever (if anyone) awaits the
returned receiver: dropping it neither ends the root nor stops the operation. The task is
tracked like every callback, so Host::close waits for it. Use it when work admitted
under the root must outlive the caller’s own wait, for example a response that keeps
streaming after its headers were handed to the application.
Source§impl Host
impl Host
Sourcepub fn cancel_call_signal(&self, call: Id)
pub fn cancel_call_signal(&self, call: Id)
Mirror a kernel call cancellation into that invocation’s signal, if it is observed.
Sourcepub fn cancel_context(&self, root: Id)
pub fn cancel_context(&self, root: Id)
Mirror a shared kernel cancellation action into native context signals, and cancel the stream ends delivered to this root at once.
Source§impl Host
impl Host
Sourcepub fn end_context(&self, root: Id)
pub fn end_context(&self, root: Id)
Revoke native claims acquired inside a root whose logical wait has ended. Shared drivers call this for roots they issue themselves. Stream ends delivered to the root are closed first, so their producers stop before the root’s claims are revoked; a retained end then refuses every read.
Source§impl Host
impl Host
Sourcepub fn cancel_effect(&self, effect: &Effect)
pub fn cancel_effect(&self, effect: &Effect)
Signal opener cancellation without acknowledging physical settlement.
Source§impl Host
impl Host
Sourcepub fn on_log(&self, observer: impl Fn(&LogRecord) + 'static)
pub fn on_log(&self, observer: impl Fn(&LogRecord) + 'static)
Observe the records native Orbs write with Context::log; a later observer replaces this
one. Without an observer, records are dropped. The host releases its observer when it
closes.
Source§impl Host
impl Host
Source§impl Host
impl Host
Source§impl Host
impl Host
Sourcepub fn publish_state(&self, object: Id)
pub fn publish_state(&self, object: Id)
Publish a shared kernel state-change notification to native observers.
Source§impl Host
impl Host
Sourcepub fn set_driver_wake(&self, wake: impl Fn() + 'static)
pub fn set_driver_wake(&self, wake: impl Fn() + 'static)
Attach the shared driver’s wake callback. Native settlement requests another action drain.
Sourcepub fn set_foreign_notifier(
&self,
notify: impl Fn(ForeignNotification) + 'static,
)
pub fn set_foreign_notifier( &self, notify: impl Fn(ForeignNotification) + 'static, )
Attach metadata-only notifications for foreign root and reference cleanup.
Sourcepub fn set_foreign_dispatcher(
&self,
dispatch: impl Fn(Value) -> LocalBoxFuture<'static, Result<Value>> + 'static,
)
pub fn set_foreign_dispatcher( &self, dispatch: impl Fn(Value) -> LocalBoxFuture<'static, Result<Value>> + 'static, )
Attach the codec-bound service callback path provided by a foreign execution adapter.
Sourcepub fn poll_settled(&self, cx: &mut Context<'_>) -> Poll<()>
pub fn poll_settled(&self, cx: &mut Context<'_>) -> Poll<()>
Wake an attached driver when native work settles without keeping idle infrastructure alive.
Source§impl Host
impl Host
Sourcepub fn cancel_task(&self, task: Id)
pub fn cancel_task(&self, task: Id)
Mirror a shared kernel task-cancellation action into its native signal.
Source§impl Host
impl Host
Sourcepub async fn invoke_portable(
&self,
call: Invocation,
arguments: Value,
) -> Result<Value>
pub async fn invoke_portable( &self, call: Invocation, arguments: Value, ) -> Result<Value>
Execute an admitted native call through its codec-compatible entrypoint.
Sourcepub fn portable_value(&self, id: Id) -> Result<Value>
pub fn portable_value(&self, id: Id) -> Result<Value>
Encode a value only if its declaration permits language crossing.
Sourcepub fn drop_value(&self, id: Id)
pub fn drop_value(&self, id: Id)
Release one native bridge value.
Source§impl Host
impl Host
Sourcepub fn new(executor: impl LocalSpawn + 'static) -> Self
pub fn new(executor: impl LocalSpawn + 'static) -> Self
Create a native host driven by the supplied local executor.
Sourcepub fn with_kernel(kernel: Host, executor: impl LocalSpawn + 'static) -> Self
pub fn with_kernel(kernel: Host, executor: impl LocalSpawn + 'static) -> Self
Attach native callbacks to an existing shared kernel.
Sourcepub fn with_clock(
kernel: Host,
executor: impl LocalSpawn + 'static,
clock: impl Clock + 'static,
) -> Self
pub fn with_clock( kernel: Host, executor: impl LocalSpawn + 'static, clock: impl Clock + 'static, ) -> Self
Create a host with an embedding-supplied monotonic clock and timer.
Sourcepub fn has_orb(&self, id: Id) -> bool
pub fn has_orb(&self, id: Id) -> bool
Check whether this adapter retains the orb implementation.
Sourcepub fn delegate_actions(&self)
pub fn delegate_actions(&self)
Give the shared JS adapter exclusive ownership of action dispatch.
Sourcepub fn install(&self, orbs: Vec<Orb>) -> Result<()>
pub fn install(&self, orbs: Vec<Orb>) -> Result<()>
Install compiled native orbs without replacing existing implementations.
Sourcepub fn get(
&self,
service: &str,
key: Vec<String>,
principal: &str,
) -> Result<Reference>
pub fn get( &self, service: &str, key: Vec<String>, principal: &str, ) -> Result<Reference>
Acquire an object reference and schedule its native activation.
Sourcepub fn errors(&self) -> Vec<Error>
pub fn errors(&self) -> Vec<Error>
Drain errors collected during callback execution and cleanup.
Sourcepub async fn close(&self) -> Result<()>
pub async fn close(&self) -> Result<()>
Waits for physical callbacks and all resource closers; cancellation cannot force termination.
Sourcepub fn finish_close(&self) -> Result<()>
pub fn finish_close(&self) -> Result<()>
Release native callback storage after the shared driver has physically settled shutdown. The kernel refuses premature completion without discarding active owners.