pub struct K2KSubBroker {
tenant_id: TenantId,
endpoints: RwLock<HashMap<KernelId, Sender<K2KMessage>>>,
routing_table: RwLock<HashMap<KernelId, KernelId>>,
kernel_audit_tags: RwLock<HashMap<KernelId, AuditTag>>,
messages_delivered: AtomicU64,
}Expand description
Per-tenant sub-broker.
Each K2KSubBroker is an independent routing domain: its endpoint map and
indirect-routing table are not visible to any other tenant. Cross-tenant
sends therefore have no possible route and are rejected by the parent
K2KBroker before they reach any sub-broker.
Fields§
§tenant_id: TenantIdThe tenant this sub-broker serves. 0 = unspecified (legacy).
endpoints: RwLock<HashMap<KernelId, Sender<K2KMessage>>>Registered endpoints (kernel_id -> sender).
routing_table: RwLock<HashMap<KernelId, KernelId>>Indirect routing table (destination -> next-hop).
Default audit tag applied to messages if the sender doesn’t provide one (per-kernel tag, set at registration).
messages_delivered: AtomicU64Messages successfully delivered from this sub-broker.
Implementations§
Source§impl K2KSubBroker
impl K2KSubBroker
fn new(tenant_id: TenantId) -> Self
Sourcepub fn endpoint_count(&self) -> usize
pub fn endpoint_count(&self) -> usize
Number of kernels registered in this sub-broker.
Sourcepub fn messages_delivered(&self) -> u64
pub fn messages_delivered(&self) -> u64
Number of messages successfully delivered by this sub-broker.
Sourcepub fn knows(&self, kernel_id: &KernelId) -> bool
pub fn knows(&self, kernel_id: &KernelId) -> bool
Returns true if this sub-broker has a route (direct or indirect)
for kernel_id.
Sourcepub fn audit_tag_for(&self, kernel_id: &KernelId) -> AuditTag
pub fn audit_tag_for(&self, kernel_id: &KernelId) -> AuditTag
Get the audit tag associated with a kernel at registration time, or
AuditTag::unspecified if none was set.