pub struct SensorTopicBus {
pub router: Arc<TopicRouter>,
pub chain: SensorFrameChainIndex,
/* private fields */
}Expand description
Kernel-side publisher: TopicRouter registration + local fan-out + ExoChain.
Subscribers attach via TopicRouter::subscribe on cluster-suffixed topic
names, and/or via SensorTopicBus::subscribe_local for in-process tests.
Fields§
§router: Arc<TopicRouter>Topic router for subscriber registration.
chain: SensorFrameChainIndexExoChain stand-in index.
Implementations§
Source§impl SensorTopicBus
impl SensorTopicBus
Sourcepub fn with_router(router: Arc<TopicRouter>) -> Self
pub fn with_router(router: Arc<TopicRouter>) -> Self
Construct around an existing topic router (kernel boot path).
Sourcepub fn register_well_known_topics(&self)
pub fn register_well_known_topics(&self)
Register the three base topics on the router for discovery.
TopicRouter is lazy (entries appear on subscribe). We touch each base
topic with a sentinel subscribe/unsubscribe so list_topics can see
them once real subscribers attach; the constants remain the source of
truth either way.
Sourcepub fn well_known_topics(&self) -> &'static [&'static str]
pub fn well_known_topics(&self) -> &'static [&'static str]
Well-known topic names (always three).
Sourcepub fn subscribe_pid(
&self,
pid: Pid,
topic: MeshSensorTopic,
cluster: Option<&str>,
)
pub fn subscribe_pid( &self, pid: Pid, topic: MeshSensorTopic, cluster: Option<&str>, )
Subscribe a process to a sensor topic (with optional cluster suffix).
Sourcepub fn subscribe_local(&mut self, topic: &str)
pub fn subscribe_local(&mut self, topic: &str)
Local test subscriber: buffers published payloads for a topic.
Sourcepub fn drain_local(&mut self, topic: &str) -> Vec<Vec<u8>>
pub fn drain_local(&mut self, topic: &str) -> Vec<Vec<u8>>
Drain local subscriber buffer for a topic.
Sourcepub fn publish(
&mut self,
env: SensorMeshEnvelope,
) -> Result<SensorPublishResult, String>
pub fn publish( &mut self, env: SensorMeshEnvelope, ) -> Result<SensorPublishResult, String>
Publish a sensor envelope: mesh frame encode check, local fan-out, TopicRouter subscriber count, ExoChain index.
Sourcepub fn last_payload(&self, topic: &str) -> Option<&[u8]>
pub fn last_payload(&self, topic: &str) -> Option<&[u8]>
Last payload for a topic (if any).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for SensorTopicBus
impl !UnwindSafe for SensorTopicBus
impl Freeze for SensorTopicBus
impl Send for SensorTopicBus
impl Sync for SensorTopicBus
impl Unpin for SensorTopicBus
impl UnsafeUnpin for SensorTopicBus
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more