pub struct DurabilityService { /* private fields */ }Expand description
The durability daemon. Uses TWO participants per domain — one for ingest
(reader) and one for replay (writer) — that mutually ignore each other.
This is set up before any endpoint exists, so the ingest reader can never
match the replay writer (race-free echo-loop prevention). Both serve any
number of TRANSIENT/PERSISTENT topics over a single DurabilityStore.
Implementations§
Source§impl DurabilityService
impl DurabilityService
Sourcepub fn serve(&self, topic_name: &str, contract: Contract) -> Result<()>
pub fn serve(&self, topic_name: &str, contract: Contract) -> Result<()>
Begins serving topic_name with the given retention contract. Creates
the ingest reader + replay writer, primes the writer from the store
(startup-sync), and spawns the ingest pump.
§Errors
Topic/reader/writer creation or the initial store/replay failed.
Sourcepub fn serve_typed(
&self,
topic_name: &str,
type_name: &str,
keyed: bool,
contract: Contract,
) -> Result<()>
pub fn serve_typed( &self, topic_name: &str, type_name: &str, keyed: bool, contract: Contract, ) -> Result<()>
Like serve but for a topic whose application type-name
is type_name rather than the native zerodds::RawBytes — e.g. a
foreign-vendor TRANSIENT writer (Cyclone/FastDDS/OpenDDS) discovered on
the wire. The typed RawBytes topic is locked to zerodds::RawBytes, so
it would never match a foreign writer under use_xtypes=no
(match keyed on topic_name + type_name). This path uses the
runtime-level user-entity API so the ingest reader + replay writer
register under the discovered type_name (and the matching
keyed/no-key kind) — exactly how the byte-oriented C-FFI achieves
cross-vendor matching.
Echo is avoided structurally: the ingest reader lives on the ingest
participant and the replay writer on the replay participant, which
mutually ignore_participant each other (set in start).
keyed must match the foreign writer’s key kind (RTPS entityKind, Spec
§9.3.1.2). Increment-1 scope is unkeyed; false is the safe default.
§Errors
Participant runtime unavailable, reader/writer registration failed, or the initial store read / replay-prime failed.
Sourcepub fn served_topics(&self) -> Result<Vec<String>>
pub fn served_topics(&self) -> Result<Vec<String>>
Sourcepub fn enable_auto_discovery(
self: &Arc<Self>,
default_contract: Contract,
) -> Result<()>
pub fn enable_auto_discovery( self: &Arc<Self>, default_contract: Contract, ) -> Result<()>
Auto-serve any topic whose discovered writers declare a durability of
TRANSIENT or PERSISTENT — observed via the standard DCPSPublication
builtin reader. This needs no application-side code: apps simply set
their DurabilityQosPolicy, and the service picks the topic up. Topics
use default_contract (the DurabilityServiceQosPolicy is not carried
in discovery; a per-topic override would come from service config).
§Errors
Spawning the discovery thread failed.
Sourcepub fn shutdown(&self)
pub fn shutdown(&self)
Stops all pumps + the auto-discovery thread and tears the daemon down.
Takes &self (not self) so it is callable on an Arc<DurabilityService>
even while the auto-discovery thread still holds a clone. Drains the join
handles under the lock, then joins WITHOUT holding it (the auto-discovery
thread may itself be inside serve taking the lock).