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
impl TenantHandle
Sourcepub fn base_opcode(&self) -> u32
pub fn base_opcode(&self) -> u32
First opcode this tenant owns.
Sourcepub fn global_opcode(&self, local: u32) -> Result<u32, TenantError>
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.
Sourcepub fn publish_slot(
&self,
ring_bytes: &mut [u8],
slot_idx: u32,
local_opcode: u32,
args: &[u32],
) -> Result<(), TenantError>
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
TenantError::Revokedif the tenant was unregistered.TenantError::OpcodeOutOfRangeiflocal_opcodeis outside the tenant’s window.TenantError::Pipelinewhen the underlyingpublish_slotrejects (e.g., slot still in-flight).
Sourcepub fn published_count(&self) -> u64
pub fn published_count(&self) -> u64
Number of slots this tenant has ever published.
Sourcepub fn drained_count(&self) -> u64
pub fn drained_count(&self) -> u64
Number of slots this tenant has observed drained (via
note_drained).
Sourcepub fn max_outstanding_slots(&self) -> u64
pub fn max_outstanding_slots(&self) -> u64
Maximum host-visible slots this tenant may keep outstanding.
Sourcepub fn reserve_staging_bytes(&self, byte_count: u64) -> Result<(), TenantError>
pub fn reserve_staging_bytes(&self, byte_count: u64) -> Result<(), TenantError>
Reserve staging bytes against this tenant’s quota.
Sourcepub fn release_staging_bytes(&self, byte_count: u64) -> Result<(), TenantError>
pub fn release_staging_bytes(&self, byte_count: u64) -> Result<(), TenantError>
Release staging bytes previously reserved by this tenant.
Sourcepub fn reserve_resident_handles(
&self,
handle_count: u64,
) -> Result<(), TenantError>
pub fn reserve_resident_handles( &self, handle_count: u64, ) -> Result<(), TenantError>
Reserve resident handles against this tenant’s quota.
Sourcepub fn release_resident_handles(
&self,
handle_count: u64,
) -> Result<(), TenantError>
pub fn release_resident_handles( &self, handle_count: u64, ) -> Result<(), TenantError>
Release resident handles previously reserved by this tenant.
Sourcepub fn quota_counters(&self) -> TenantQuotaCounters
pub fn quota_counters(&self) -> TenantQuotaCounters
Snapshot quota counters for this tenant.
Sourcepub fn runtime_counters(&self) -> TenantRuntimeCounters
pub fn runtime_counters(&self) -> TenantRuntimeCounters
Snapshot host-visible runtime counters for this tenant.
Sourcepub fn note_drained(&self, count: u64)
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.
Sourcepub fn quiesce(&self, max_spins: u64) -> Result<(), TenantError>
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
impl Clone for TenantHandle
Source§fn clone(&self) -> TenantHandle
fn clone(&self) -> TenantHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more