Skip to main content

TenantHandle

Struct TenantHandle 

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

Stable handle returned by TenantRegistry::register. Clones share the same underlying state, so multiple producer threads inside one tenant can publish through their own handles.

Implementations§

Source§

impl TenantHandle

Source

pub fn id(&self) -> u32

Stable tenant id; maps onto the ring-slot TENANT_WORD.

Source

pub fn label(&self) -> &str

Human-readable label supplied at registration time.

Source

pub fn base_opcode(&self) -> u32

First opcode this tenant owns.

Source

pub fn global_opcode(&self, local: u32) -> Result<u32, TenantError>

Convert a tenant-local opcode to the global opcode used in the ring slot. Caller enforces local < opcode_cap().

§Errors

Returns TenantError::OpcodeOutOfRange when the local value is outside the reserved window.

Source

pub fn publish_slot( &self, ring_bytes: &mut [u8], slot_idx: u32, local_opcode: u32, args: &[u32], ) -> Result<(), TenantError>

Publish a slot into the tenant’s ring with a tenant-local opcode. Convenience wrapper that composes Megakernel::publish_slot with tenant bookkeeping.

§Errors
Source

pub fn published_count(&self) -> u64

Number of slots this tenant has ever published.

Source

pub fn drained_count(&self) -> u64

Number of slots this tenant has observed drained (via note_drained).

Source

pub fn max_outstanding_slots(&self) -> u64

Maximum host-visible slots this tenant may keep outstanding.

Source

pub fn reserve_staging_bytes(&self, byte_count: u64) -> Result<(), TenantError>

Reserve staging bytes against this tenant’s quota.

Source

pub fn release_staging_bytes(&self, byte_count: u64) -> Result<(), TenantError>

Release staging bytes previously reserved by this tenant.

Source

pub fn reserve_resident_handles( &self, handle_count: u64, ) -> Result<(), TenantError>

Reserve resident handles against this tenant’s quota.

Source

pub fn release_resident_handles( &self, handle_count: u64, ) -> Result<(), TenantError>

Release resident handles previously reserved by this tenant.

Source

pub fn quota_counters(&self) -> TenantQuotaCounters

Snapshot quota counters for this tenant.

Source

pub fn runtime_counters(&self) -> TenantRuntimeCounters

Snapshot host-visible runtime counters for this tenant.

Source

pub fn note_drained(&self, count: u64)

Mark count slots as drained. The host pump that observes DONE_COUNT calls this when it sees the global counter advance past the tenant’s last-published cursor.

Source

pub fn quiesce(&self, max_spins: u64) -> Result<(), TenantError>

Block-style quiesce: bounded backoff until every published slot has been drained or max_spins polls elapse.

§Errors

Returns TenantError::QuiesceTimeout when max_spins iterations pass without full drain. The outstanding count at timeout is included for diagnostics.

Trait Implementations§

Source§

impl Clone for TenantHandle

Source§

fn clone(&self) -> TenantHandle

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
Source§

impl Debug for TenantHandle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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<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> 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> 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<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