Skip to main content

TenantRegistry

Struct TenantRegistry 

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

Thread-safe tenant registry. One per megakernel instance.

Implementations§

Source§

impl TenantRegistry

Source

pub fn new() -> Self

Fresh registry with no tenants.

Source

pub fn register( &self, label: impl Into<String>, ) -> Result<TenantHandle, TenantError>

Register a new tenant with the given diagnostic label. Returns a handle whose opcode range is reserved until unregister is called.

§Errors

Returns TenantError::RegistryFull when the tenant id or opcode space is exhausted.

Source

pub fn register_with_backpressure( &self, label: impl Into<String>, max_outstanding_slots: u64, ) -> Result<TenantHandle, TenantError>

Register a new tenant with a bounded outstanding-slot budget.

§Errors

Returns TenantError::RegistryFull when the tenant id or opcode space is exhausted.

Source

pub fn register_with_quotas( &self, label: impl Into<String>, quota: TenantQuota, ) -> Result<TenantHandle, TenantError>

Register a tenant with explicit ring-slot, staging-byte, and resident-handle quotas.

§Errors

Returns TenantError::RegistryFull when the tenant id or opcode space is exhausted.

Source

pub fn unregister(&self, tenant_id: u32) -> Option<TenantHandle>

Unregister a tenant. Future publishes on the handle fail with TenantError::Revoked. In-flight slots already on the GPU still execute - the host is responsible for quiescing before unregister if it needs that guarantee.

Source

pub fn active_tenants(&self) -> Vec<TenantHandle>

Snapshot of active tenants for observability / diagnostics.

Source

pub fn active_tenants_into(&self, out: &mut Vec<TenantHandle>)

Snapshot active tenants into caller-owned storage.

Source

pub fn lookup(&self, tenant_id: u32) -> Option<TenantHandle>

Look up a tenant by id. Returns None if the id was unregistered.

Source

pub fn runtime_counters(&self) -> Vec<TenantRuntimeCounters>

Snapshot runtime counters for every active tenant.

Source

pub fn runtime_counters_into(&self, out: &mut Vec<TenantRuntimeCounters>)

Snapshot runtime counters into caller-owned storage.

Source

pub fn select_concurrent_tenants(&self, conflict_adj: &[u32]) -> Vec<u32>

Select a maximal independent subset of tenants for a fair schedule slot.

conflict_adj[i*n+j] != 0 means tenants i and j cannot share the same dispatch slot (e.g., both pinned to the same queue, or both holding mutually-exclusive opcode locks). The Returns a Vec of tenant ids in selection order. Empty if no tenants are active.

Source

pub fn select_concurrent_tenants_into( &self, conflict_adj: &[u32], out: &mut Vec<u32>, scratch: &mut TenantSelectionScratch, )

Select a maximal independent tenant subset into caller-owned storage.

Trait Implementations§

Source§

impl Default for TenantRegistry

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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, 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