Skip to main content

DurabilityService

Struct DurabilityService 

Source
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

Source

pub fn start(domain: i32, store: Arc<dyn DurabilityStore>) -> Result<Self>

Starts the daemon on domain, backed by store.

§Errors

Participant creation failed.

Source

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.

Source

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.

Source

pub fn served_topics(&self) -> Result<Vec<String>>

Topics currently served.

§Errors

Lock poisoned.

Source

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.

Source

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).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.