Skip to main content

Host

Struct Host 

Source
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

Source

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.

Source

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

Source

pub fn access( &self, orb: Id, service: &str, principal: &str, ) -> Option<BTreeSet<String>>

Resolve an optional native service access policy for a shared adapter’s acquisition.

Source§

impl Host

Source

pub fn activate(&self, object: Id, orb: Id, service: &str) -> Result<Id>

Used by a foreign language adapter after the shared kernel reserves the object.

Source

pub async fn dispose(&self, object: Id) -> Result<()>

Release native object storage after its scope cleanup settles.

Source§

impl Host

Source

pub fn now_ms(&self) -> u64

Read the monotonic host clock used by both native and embedded adapters.

Source

pub fn now(&self) -> f64

Preserve fractional timing while sharing the kernel’s calibrated monotonic origin.

Source§

impl Host

Source

pub fn context( &self, root: Id, invocation: Option<Invocation>, ) -> Result<Context>

Issue a context for an active root and matching invocation.

Source

pub async fn root<T>( &self, principal: &str, operation: impl FnOnce(Context) -> LocalBoxFuture<'static, Result<T>>, ) -> Result<T>

Run an operation while a guard retains its root lifetime.

Source§

impl Host

Source

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

Source

pub fn cancel_call_signal(&self, call: Id)

Mirror a kernel call cancellation into that invocation’s signal, if it is observed.

Source

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

Source

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

Source

pub fn flush(&self)

Drain native-owned actions. A shared JS adapter owns its own drain.

Source

pub fn cancel_effect(&self, effect: &Effect)

Signal opener cancellation without acknowledging physical settlement.

Source

pub async fn execute_effect(&self, effect: &Effect) -> Result<Option<Id>>

Execute physical resource callbacks requested by the kernel.

Source§

impl Host

Source

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

Source

pub async fn reload(&self, orbs: Vec<Orb>, deadline_ms: u64) -> Result<Version>

Replace implementations through kernel-owned preparation, publication and physical cleanup. The operation remains owned by the host if its observer stops waiting.

Source

pub async fn remove( &self, names: Vec<String>, deadline_ms: u64, ) -> Result<Version>

Withdraw named Orbs through kernel-owned preparation, publication and physical cleanup. Retained roots keep their version. The operation remains owned by the host if its observer stops waiting.

Source§

impl Host

Source

pub fn declare<T>( &self, create: impl FnOnce(Declaration) -> Result<T>, ) -> Result<T>

Declare a host-owned environment and resources before installing or acquiring orbs. The kernel activates the scope and closes it after all child scopes settle.

Source

pub fn resource<T: 'static>(&self, name: &str) -> Result<Resource<T>>

Read a named host resource. Its value remains unavailable until activation completes.

Source§

impl Host

Source

pub async fn ready(&self) -> Result<()>

Wait for the currently declared host and orb scopes, including asynchronous openers.

Source§

impl Host

Source

pub fn notify(&self, action: &Action) -> bool

Deliver a kernel action owned by native callback storage. Returns true when the native adapter exclusively consumes the action.

Source§

impl Host

Source

pub fn publish_state(&self, object: Id)

Publish a shared kernel state-change notification to native observers.

Source§

impl Host

Source

pub fn set_driver_wake(&self, wake: impl Fn() + 'static)

Attach the shared driver’s wake callback. Native settlement requests another action drain.

Source

pub fn set_foreign_notifier( &self, notify: impl Fn(ForeignNotification) + 'static, )

Attach metadata-only notifications for foreign root and reference cleanup.

Source

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.

Source

pub fn poll_settled(&self, cx: &mut Context<'_>) -> Poll<()>

Wake an attached driver when native work settles without keeping idle infrastructure alive.

Source

pub async fn settled(&self)

Wait for native physical callbacks while the shared adapter continues driving kernel actions.

Source§

impl Host

Source

pub fn cancel_task(&self, task: Id)

Mirror a shared kernel task-cancellation action into its native signal.

Source§

impl Host

Source

pub async fn invoke_portable( &self, call: Invocation, arguments: Value, ) -> Result<Value>

Execute an admitted native call through its codec-compatible entrypoint.

Source

pub fn portable_value(&self, id: Id) -> Result<Value>

Encode a value only if its declaration permits language crossing.

Source

pub fn drop_value(&self, id: Id)

Release one native bridge value.

Source§

impl Host

Source

pub fn new(executor: impl LocalSpawn + 'static) -> Self

Create a native host driven by the supplied local executor.

Source

pub fn with_kernel(kernel: Host, executor: impl LocalSpawn + 'static) -> Self

Attach native callbacks to an existing shared kernel.

Source

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.

Source

pub fn kernel(&self) -> Host

Clone the shared kernel handle without copying its storage.

Source

pub fn has_orb(&self, id: Id) -> bool

Check whether this adapter retains the orb implementation.

Source

pub fn delegate_actions(&self)

Give the shared JS adapter exclusive ownership of action dispatch.

Source

pub fn install(&self, orbs: Vec<Orb>) -> Result<()>

Install compiled native orbs without replacing existing implementations.

Source

pub fn get( &self, service: &str, key: Vec<String>, principal: &str, ) -> Result<Reference>

Acquire an object reference and schedule its native activation.

Source

pub fn errors(&self) -> Vec<Error>

Drain errors collected during callback execution and cleanup.

Source

pub async fn close(&self) -> Result<()>

Waits for physical callbacks and all resource closers; cancellation cannot force termination.

Source

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.

Trait Implementations§

Source§

impl Clone for Host

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Host

§

impl !Send for Host

§

impl !Sync for Host

§

impl !UnwindSafe for Host

§

impl Forget for Host

§

impl Freeze for Host

§

impl Move for Host

§

impl Unpin for Host

§

impl UnsafeUnpin for Host

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<T> CloneToUninit for T
where T: Clone,

Source§

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

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.