pub struct TenantRegistry { /* private fields */ }Expand description
Thread-safe tenant registry. One per megakernel instance.
Implementations§
Source§impl TenantRegistry
impl TenantRegistry
Sourcepub fn register(
&self,
label: impl Into<String>,
) -> Result<TenantHandle, TenantError>
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.
Sourcepub fn register_with_backpressure(
&self,
label: impl Into<String>,
max_outstanding_slots: u64,
) -> Result<TenantHandle, TenantError>
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.
Sourcepub fn register_with_quotas(
&self,
label: impl Into<String>,
quota: TenantQuota,
) -> Result<TenantHandle, TenantError>
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.
Sourcepub fn unregister(&self, tenant_id: u32) -> Option<TenantHandle>
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.
Sourcepub fn active_tenants(&self) -> Vec<TenantHandle>
pub fn active_tenants(&self) -> Vec<TenantHandle>
Snapshot of active tenants for observability / diagnostics.
Sourcepub fn active_tenants_into(&self, out: &mut Vec<TenantHandle>)
pub fn active_tenants_into(&self, out: &mut Vec<TenantHandle>)
Snapshot active tenants into caller-owned storage.
Sourcepub fn lookup(&self, tenant_id: u32) -> Option<TenantHandle>
pub fn lookup(&self, tenant_id: u32) -> Option<TenantHandle>
Look up a tenant by id. Returns None if the id was
unregistered.
Sourcepub fn runtime_counters(&self) -> Vec<TenantRuntimeCounters>
pub fn runtime_counters(&self) -> Vec<TenantRuntimeCounters>
Snapshot runtime counters for every active tenant.
Sourcepub fn runtime_counters_into(&self, out: &mut Vec<TenantRuntimeCounters>)
pub fn runtime_counters_into(&self, out: &mut Vec<TenantRuntimeCounters>)
Snapshot runtime counters into caller-owned storage.
Sourcepub fn select_concurrent_tenants(&self, conflict_adj: &[u32]) -> Vec<u32>
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.
Sourcepub fn select_concurrent_tenants_into(
&self,
conflict_adj: &[u32],
out: &mut Vec<u32>,
scratch: &mut TenantSelectionScratch,
)
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.