pub struct DcpsRuntime {Show 14 fields
pub guid_prefix: GuidPrefix,
pub domain_id: i32,
pub spdp_multicast_rx: Arc<UdpTransport>,
pub spdp_unicast: Arc<UdpTransport>,
pub user_unicast: Arc<dyn Transport + Send + Sync>,
pub user_announce_locator: Locator,
pub sedp: Arc<Mutex<SedpStack>>,
pub type_lookup_endpoints: TypeLookupEndpoints,
pub type_lookup_server: Arc<Mutex<TypeLookupServer>>,
pub type_lookup_client: Arc<Mutex<TypeLookupClient>>,
pub security_builtin: Mutex<Option<Arc<Mutex<SecurityBuiltinStack>>>>,
pub same_host: Arc<SameHostTracker>,
pub config: RuntimeConfig,
pub wlp: Arc<Mutex<WlpEndpoint>>,
/* private fields */
}Expand description
The runtime of a DomainParticipant. Hosts all background
threads and UDP sockets.
Fields§
§guid_prefix: GuidPrefixParticipant GUID prefix (12-byte identifier, random per instance).
domain_id: i32Domain id.
spdp_multicast_rx: Arc<UdpTransport>SPDP multicast receiver socket.
spdp_unicast: Arc<UdpTransport>SPDP unicast socket (for bidirectional SPDP, B2).
user_unicast: Arc<dyn Transport + Send + Sync>User-data unicast transport (default user unicast, where peers
send matched samples). Trait object: can be UDP/v4 or /v6,
and in phase C additionally TCP or SHM (env var
ZERODDS_USER_TRANSPORT). Discovery (SPDP/SEDP) stays UDP-only.
user_announce_locator: LocatorResolved user-unicast locator (routable interface address,
not 0.0.0.0). Written as PID_UNICAST_LOCATOR into EVERY
SEDP pub/sub announce (DDSI-RTPS 2.5 §8.5.3.2/3)
and as the participant DEFAULT_UNICAST_LOCATOR in SPDP. Precomputed
via announce_locator, so the endpoint and participant locators
are guaranteed identical.
sedp: Arc<Mutex<SedpStack>>SEDP stack for publication/subscription announce + discovery.
type_lookup_endpoints: TypeLookupEndpointsTypeLookup-Service Builtin-Endpoint-GUIDs (XTypes 1.3 §7.6.3.3.4).
type_lookup_server: Arc<Mutex<TypeLookupServer>>TypeLookup server (server-side handler over the local TypeRegistry).
type_lookup_client: Arc<Mutex<TypeLookupClient>>TypeLookup client (client-side correlation table for outstanding requests).
security_builtin: Mutex<Option<Arc<Mutex<SecurityBuiltinStack>>>>Security builtin endpoint stack
(DCPSParticipantStatelessMessage + DCPSParticipantVolatile- MessageSecure). None as long as no security plugin is active
— the hot path then skips any security-builtin
demux. Some is set via DcpsRuntime::enable_security_builtins
as soon as the factory has registered a plugin.
same_host: Arc<SameHostTracker>Wave 4 (Spec zerodds-zero-copy-1.0 §6): tracker for
same-host (writer, reader) pairs. The SEDP match hook registers
here every pair whose remote prefix carries the same host-id prefix
as the local participant. The hot-path send consults
the tracker and routes over SHM instead of UDP in the Bound state.
config: RuntimeConfigConfiguration (cloned from RuntimeConfig).
wlp: Arc<Mutex<WlpEndpoint>>Writer-Liveliness-Protocol endpoint (RTPS 2.5 §8.4.13).
Sends periodic ParticipantMessageData heartbeats and
tracks last-seen per remote participant.
Implementations§
Source§impl DcpsRuntime
impl DcpsRuntime
Sourcepub fn writer_guid(&self, eid: EntityId) -> [u8; 16]
pub fn writer_guid(&self, eid: EntityId) -> [u8; 16]
The 16-byte RTPS GUID of a local writer with EntityId eid (this
participant’s GUID prefix ++ the entity id). Used by the cross-vendor
iceoryx-cyclone bridge to stamp the PSMX chunk with the writer’s real
GUID so a peer that discovered the writer over RTPS SEDP associates the
shared-memory sample with it.
Sourcepub fn start(
domain_id: i32,
guid_prefix: GuidPrefix,
config: RuntimeConfig,
) -> Result<Arc<Self>>
pub fn start( domain_id: i32, guid_prefix: GuidPrefix, config: RuntimeConfig, ) -> Result<Arc<Self>>
Starts a new runtime for a participant.
§Errors
TransportError if one of the 3 UDP sockets fails to bind
(e.g. a port collision on the SPDP multicast port in another
SO_REUSE-less DDS instance).
Sourcepub fn user_locator(&self) -> Locator
pub fn user_locator(&self) -> Locator
Local unicast locator for user data (announced in SPDP).
Sourcepub fn spdp_unicast_locator(&self) -> Locator
pub fn spdp_unicast_locator(&self) -> Locator
Local unicast locator for SPDP metatraffic.
Sourcepub fn announced_builtin_endpoint_set(&self) -> u32
pub fn announced_builtin_endpoint_set(&self) -> u32
Returns the BuiltinEndpointSet bitmask that the runtime
currently announces in the SPDP beacon. Used for tests + diagnostics;
production consumers should decode the SPDP beacon
themselves.
Sourcepub fn register_type_object(&self, obj: TypeObject) -> Result<EquivalenceHash>
pub fn register_type_object(&self, obj: TypeObject) -> Result<EquivalenceHash>
Registers a TypeObject in the local TypeLookup server
registry. Other participants can then query this type via
a getTypes request (XTypes 1.3 §7.6.3.3.4).
Returns the EquivalenceHash of the registered type
(the caller can embed it e.g. in PublicationBuiltinTopicData as a
PID_TYPE_INFORMATION hint).
§Errors
DdsError::PreconditionNotMet on lock poisoning or a hash
computation error.
Sourcepub fn send_type_lookup_request(
&self,
peer: GuidPrefix,
type_hashes: &[EquivalenceHash],
) -> Result<Option<RequestId>>
pub fn send_type_lookup_request( &self, peer: GuidPrefix, type_hashes: &[EquivalenceHash], ) -> Result<Option<RequestId>>
Sends a getTypes request to a discovered peer and
returns a RequestId with which the caller can correlate the
asynchronous reply later (XTypes 1.3
§7.6.3.3.4 + TypeLookupClient::handle_reply).
peer must be in discovered_participants() — otherwise
None is returned (no known peer locator). On a
successful send the request sample-identity sequence
is returned as the RequestId; an incoming reply is correlated on
this sequence ID.
§Errors
DdsError::PreconditionNotMet on encode errors or lock
poisoning.
Sourcepub fn enable_security_builtins(
&self,
vendor_id: VendorId,
) -> Arc<Mutex<SecurityBuiltinStack>> ⓘ
pub fn enable_security_builtins( &self, vendor_id: VendorId, ) -> Arc<Mutex<SecurityBuiltinStack>> ⓘ
Activates the security builtin endpoint stack
(DCPSParticipantStatelessMessage + DCPSParticipantVolatile- MessageSecure). Typically called by the factory
once a security plugin is registered on the participant.
Idempotent: a second call has no effect. Returns the (possibly
freshly created) stack handle.
Sourcepub fn security_builtin_snapshot(
&self,
) -> Option<Arc<Mutex<SecurityBuiltinStack>>>
pub fn security_builtin_snapshot( &self, ) -> Option<Arc<Mutex<SecurityBuiltinStack>>>
Snapshot handle on the security builtin stack. None if
enable_security_builtins
has not been called yet.
Sourcepub fn assert_liveliness(&self)
pub fn assert_liveliness(&self)
assert_liveliness() on the DomainParticipant (DCPS 1.4
§2.2.3.11 MANUAL_BY_PARTICIPANT). Sends exactly one WLP heartbeat
with kind = MANUAL_BY_PARTICIPANT on the next tick;
all readers matching this participant refresh their
last-seen timestamp. Idempotent — multiple calls within
one tick period result in multiple wire sends up to the
cap (MAX_QUEUED_PULSES = 32).
Sourcepub fn assert_writer_liveliness(&self, topic_token: Vec<u8>)
pub fn assert_writer_liveliness(&self, topic_token: Vec<u8>)
assert_liveliness() on a DataWriter (DCPS 1.4 §2.2.3.11
MANUAL_BY_TOPIC). topic_token is an opaque token that
matching readers can use to associate the pulse with a concrete
topic. We use the ZeroDDS vendor kind (Cyclone /
Fast-DDS ignore the vendor kind, which is spec-conformant —
MSB-set in kind requests “ignore unknown” behavior).
Sourcepub fn peer_liveliness_last_seen(&self, prefix: &GuidPrefix) -> Option<Duration>
pub fn peer_liveliness_last_seen(&self, prefix: &GuidPrefix) -> Option<Duration>
Current WLP last-seen timestamp of a remote peer (relative
to runtime start). None if the peer has not sent a WLP
heartbeat yet.
Sourcepub fn peer_capabilities(&self, prefix: &GuidPrefix) -> Option<PeerCapabilities>
pub fn peer_capabilities(&self, prefix: &GuidPrefix) -> Option<PeerCapabilities>
Returns the zerodds_discovery::PeerCapabilities of a remote
peer, based on its most recently received SPDP beacon.
None if the peer has not been discovered via SPDP yet.
Sourcepub fn discovered_participants(&self) -> Vec<DiscoveredParticipant>
pub fn discovered_participants(&self) -> Vec<DiscoveredParticipant>
Snapshot of the currently discovered remote participants. Key = GUID prefix, value = last seen beacon content.
Sourcepub fn attach_builtin_sinks(&self, sinks: BuiltinSinks)
pub fn attach_builtin_sinks(&self, sinks: BuiltinSinks)
Wires the BuiltinSinks of the DomainParticipant into the
discovery hot path. From this
call on, all SPDP/SEDP receive events land as samples in
the 4 builtin-topic readers.
Called by the DomainParticipant constructor exactly once during
setup.
Sourcepub fn attach_ignore_filter(&self, filter: IgnoreFilter)
pub fn attach_ignore_filter(&self, filter: IgnoreFilter)
Wires the IgnoreFilter of the DomainParticipant into the
discovery hot path. From
this call on, SPDP/SEDP receive events are checked against the
filter before being pushed as a builtin sample or used as an
SEDP match source.
Called by the DomainParticipant constructor exactly once during
setup.
Sourcepub fn announce_publication(
&self,
data: &PublicationBuiltinTopicData,
) -> Result<()>
pub fn announce_publication( &self, data: &PublicationBuiltinTopicData, ) -> Result<()>
Announces a local publication via SEDP. The runtime sends the generated datagrams immediately to all already- discovered remote participants.
§Errors
WireError if encoding fails.
Sourcepub fn announce_subscription(
&self,
data: &SubscriptionBuiltinTopicData,
) -> Result<()>
pub fn announce_subscription( &self, data: &SubscriptionBuiltinTopicData, ) -> Result<()>
Announces a local subscription via SEDP. Analogous to
announce_publication.
§Errors
WireError if encoding fails.
Sourcepub fn register_user_writer(&self, cfg: UserWriterConfig) -> Result<EntityId>
pub fn register_user_writer(&self, cfg: UserWriterConfig) -> Result<EntityId>
Registers a local user writer. The caller gets the
writer EntityId; for sends via write_user_sample(eid, ...).
In the runtime there is still no automatic SEDP announce +
matching — that comes in B4b. Currently register_user_writer
is just the wiring.
§Errors
PreconditionNotMet if the registry mutex is poisoned.
Sourcepub fn register_user_writer_kind(
&self,
cfg: UserWriterConfig,
is_keyed: bool,
) -> Result<EntityId>
pub fn register_user_writer_kind( &self, cfg: UserWriterConfig, is_keyed: bool, ) -> Result<EntityId>
Like [register_user_writer] but with an explicit NoKey/WithKey
flag. Cross-vendor interop needs it: if the IDL type has no
@key, the writer MUST set is_keyed=false, otherwise
a remote reader rejects the DATA submessage due to an
entityKind mismatch (Spec §9.3.1.2 table 9.1: 0x02=WithKey
vs 0x03=NoKey).
Sourcepub fn attach_durability_backend(
&self,
eid: EntityId,
backend: Arc<dyn DurabilityBackend>,
) -> Result<()>
pub fn attach_durability_backend( &self, eid: EntityId, backend: Arc<dyn DurabilityBackend>, ) -> Result<()>
Spec §2.2.3.5 — registers a durability-service backend on
a writer already registered via [register_user_writer].
With Durability=Transient/Persistent the backend is replayed into the
HistoryCache on the first late-joiner match in
wire_writer_to_remote_reader, so the reader gets all samples —
including those no longer in the writer cache due to history eviction
or those that have survived a writer restart.
Sourcepub fn set_user_writer_wire_extensibility(
&self,
eid: EntityId,
ext: ExtensibilityForRepr,
) -> Result<()>
pub fn set_user_writer_wire_extensibility( &self, eid: EntityId, ext: ExtensibilityForRepr, ) -> Result<()>
Sets the type extensibility of a writer (FINAL/APPENDABLE/
MUTABLE). Affects exclusively the encapsulation header
of the user payload (see [user_payload_encap]) — relevant for
XCDR2 wire, where @appendable requires a D_CDR2_LE and @mutable a
PL_CDR2_LE header. The codegen/FFI calls this after
register_user_writer* when the type is not @final.
Does NOT change the SEDP announce offer list.
§Errors
BadParameter on an unknown EntityId, PreconditionNotMet on a
poisoned slot mutex.
Sourcepub fn register_user_reader(
&self,
cfg: UserReaderConfig,
) -> Result<(EntityId, Receiver<UserSample>)>
pub fn register_user_reader( &self, cfg: UserReaderConfig, ) -> Result<(EntityId, Receiver<UserSample>)>
Registers a local user reader. Returns the reader EntityId
and an mpsc::Receiver through which DataReader handles
consume incoming samples.
§Errors
PreconditionNotMet if the registry mutex is poisoned.
Registers a user reader. Returns the EntityId and an
mpsc::Receiver<UserSample> — alive samples deliver payload,
lifecycle markers carry key hash + ChangeKind.
Sourcepub fn register_user_reader_kind(
&self,
cfg: UserReaderConfig,
is_keyed: bool,
) -> Result<(EntityId, Receiver<UserSample>)>
pub fn register_user_reader_kind( &self, cfg: UserReaderConfig, is_keyed: bool, ) -> Result<(EntityId, Receiver<UserSample>)>
Like [register_user_reader] but with an explicit NoKey/WithKey
flag. Symmetric to [register_user_writer_kind] — the reader kind
must match the writer kind.
Sourcepub fn write_user_sample(&self, eid: EntityId, payload: Vec<u8>) -> Result<()>
pub fn write_user_sample(&self, eid: EntityId, payload: Vec<u8>) -> Result<()>
Writes a sample to a registered user writer and sends the generated datagrams.
The payload is prefixed with the RTPS serialized-payload header
(encapsulation scheme) before it goes into the DATA
submessage. OMG RTPS 2.5 §9.4.2.13 requires exactly these
4 bytes at the start of every serialized user payload —
see USER_PAYLOAD_ENCAP (CDR_LE / XCDR1).
Without this header Cyclone/Fast-DDS readers refuse to
deliver the sample (they parse the first 4 bytes as
encapsulation kind + options and drop unknown-scheme).
§Errors
BadParameterif the EntityId has no registered writer.WireErroron an encoding error.
Sourcepub fn set_user_writer_data_rep_override(
&self,
eid: EntityId,
offer: Option<Vec<i16>>,
) -> Result<()>
pub fn set_user_writer_data_rep_override( &self, eid: EntityId, offer: Option<Vec<i16>>, ) -> Result<()>
Sets the per-writer data-representation override for a user writer. The
next write_user_sample* derives its encapsulation header from this
override’s first element instead of the runtime default — so a
representation-faithful re-publisher (e.g. the durability service
replaying foreign-vendor XCDR1 bytes) can declare the encap that matches
the body it holds. None clears the override (back to the runtime
default). Idempotent + cheap; safe to call before every write.
§Errors
BadParameter for an unknown writer entity id; PreconditionNotMet on a
poisoned slot lock.
Sourcepub fn set_user_writer_byte_order_override(
&self,
eid: EntityId,
big_endian: bool,
) -> Result<()>
pub fn set_user_writer_byte_order_override( &self, eid: EntityId, big_endian: bool, ) -> Result<()>
Forces the writer to emit the big-endian (_BE) encapsulation variant
(RTPS 2.5 §10.5) instead of the little-endian default. Used by the
durability service replay path: a big-endian peer’s stored sample holds
big-endian body bytes, so its replay must carry a matching BE encap
header. false restores the canonical little-endian wire.
§Errors
BadParameter for an unknown writer entity id; PreconditionNotMet on a
poisoned slot lock.
Sourcepub fn set_user_writer_history_depth(
&self,
eid: EntityId,
depth: usize,
) -> Result<()>
pub fn set_user_writer_history_depth( &self, eid: EntityId, depth: usize, ) -> Result<()>
Sets the HISTORY KeepLast depth (DDS 1.4 §2.2.3.18) for a user writer.
This governs how many of the most-recent samples per instance key
are retained for the same-runtime TransientLocal late-joiner replay path
(intra_runtime_dispatch_alive retains, a new route replays). Pass
usize::MAX for KeepAll. A binding maps its HistoryQosPolicy here.
§Errors
BadParameter for an unknown writer entity id; PreconditionNotMet on a
poisoned slot lock.
Sourcepub fn user_writer_retained_len(&self, eid: EntityId) -> usize
pub fn user_writer_retained_len(&self, eid: EntityId) -> usize
Reads the current TransientLocal retained-sample count for a user writer
(test/introspection helper). 0 for an unknown writer.
Sourcepub fn write_user_sample_borrowed(
&self,
eid: EntityId,
payload: &[u8],
) -> Result<()>
pub fn write_user_sample_borrowed( &self, eid: EntityId, payload: &[u8], ) -> Result<()>
Writes a user sample from a borrowed byte slice. Zero-copy path for the loan API and SHM backend: avoids the Vec materialization when the caller holds a slot/stack buffer.
Identical semantics to write_user_sample; it just takes no
ownership of the buffer.
§Errors
As write_user_sample.
Sourcepub fn write_user_sample_keyed(
&self,
eid: EntityId,
payload: &[u8],
key_hash: [u8; 16],
) -> Result<()>
pub fn write_user_sample_keyed( &self, eid: EntityId, payload: &[u8], key_hash: [u8; 16], ) -> Result<()>
Like [write_user_sample_borrowed] but with an explicit 16-byte instance
key_hash (DDS 1.4 §2.2.2.4.2 keyed topics). The key is used by the
same-runtime TransientLocal retention path so KeepLast depth is enforced
per instance and a late joiner replays the most-recent samples of
every live instance (and any disposed/unregistered terminal marker).
A binding that does not key its topic passes the all-zero key (one
default instance), which is what write_user_sample_borrowed does.
§Errors
As [write_user_sample_borrowed].
Sourcepub fn write_user_lifecycle(
&self,
eid: EntityId,
key_hash: [u8; 16],
status_bits: u32,
) -> Result<()>
pub fn write_user_lifecycle( &self, eid: EntityId, key_hash: [u8; 16], status_bits: u32, ) -> Result<()>
Sends a lifecycle marker (dispose/unregister_instance) to
all matched readers. Spec §2.2.2.4.2.10/.7 + §9.6.3.9 PID_STATUS_INFO.
status_bits is the OR combination of
zerodds_rtps::inline_qos::status_info::DISPOSED and/or UNREGISTERED.
§Errors
BadParameterif the EntityId has no registered writer.WireErroron an encode error.
Sourcepub fn discovered_publications_count(&self) -> usize
pub fn discovered_publications_count(&self) -> usize
Snapshot of all currently known remote publications (topic name + type name + writer GUID).
Sourcepub fn discovered_publication_topics(&self) -> Vec<(String, String)>
pub fn discovered_publication_topics(&self) -> Vec<(String, String)>
Snapshot of every publication on this domain as (topic_name, type_name) — raw DDS topic/type strings — for graph introspection
(rmw_get_topic_names_and_types, rmw_count_publishers). Includes BOTH
this participant’s LOCAL user writers AND the remote publications from
SEDP, so a node sees its own topics as well as its peers’.
Sourcepub fn discovered_subscription_topics(&self) -> Vec<(String, String)>
pub fn discovered_subscription_topics(&self) -> Vec<(String, String)>
Snapshot of every subscription on this domain as (topic_name, type_name) (local user readers + remote SEDP). Counterpart to
Self::discovered_publication_topics.
Sourcepub fn discovered_subscriptions_count(&self) -> usize
pub fn discovered_subscriptions_count(&self) -> usize
Snapshot of all currently known remote subscriptions.
Sourcepub fn discovered_publication_endpoints(&self) -> Vec<DiscoveredEndpointInfo>
pub fn discovered_publication_endpoints(&self) -> Vec<DiscoveredEndpointInfo>
Per-endpoint snapshot of every publication on this domain (local user
writers + remote SEDP), for ROS 2 rmw_get_publishers_info_by_topic.
Sourcepub fn discovered_subscription_endpoints(&self) -> Vec<DiscoveredEndpointInfo>
pub fn discovered_subscription_endpoints(&self) -> Vec<DiscoveredEndpointInfo>
Counterpart to Self::discovered_publication_endpoints for
subscriptions (rmw_get_subscriptions_info_by_topic).
Sourcepub fn user_writer_matched_count(&self, eid: EntityId) -> usize
pub fn user_writer_matched_count(&self, eid: EntityId) -> usize
Number of matched remote readers for a local user writer.
Polled by DataWriter::wait_for_matched_subscription.
Sourcepub fn user_writer_matched_subscription_handles(
&self,
eid: EntityId,
) -> Vec<InstanceHandle>
pub fn user_writer_matched_subscription_handles( &self, eid: EntityId, ) -> Vec<InstanceHandle>
List of InstanceHandles of all matched readers for a local
user writer (Spec §2.2.2.4.2.x get_matched_subscriptions): remote/
cross-participant readers (reader proxies) plus the same-participant
readers from the intra-runtime routes, deduplicated by GUID.
Sourcepub fn user_reader_matched_publication_handles(
&self,
eid: EntityId,
) -> Vec<InstanceHandle>
pub fn user_reader_matched_publication_handles( &self, eid: EntityId, ) -> Vec<InstanceHandle>
List of InstanceHandles of all matched remote writers for a
local user reader (Spec §2.2.2.5.x get_matched_publications).
Sourcepub fn user_writer_offered_deadline_missed(&self, eid: EntityId) -> u64
pub fn user_writer_offered_deadline_missed(&self, eid: EntityId) -> u64
Counter for missed offered deadlines on the user writer.
Spec OMG DDS 1.4 §2.2.4.2.9 OFFERED_DEADLINE_MISSED_STATUS.
Sourcepub fn user_reader_requested_deadline_missed(&self, eid: EntityId) -> u64
pub fn user_reader_requested_deadline_missed(&self, eid: EntityId) -> u64
Counter for missed requested deadlines on the user reader.
Spec §2.2.4.2.11 REQUESTED_DEADLINE_MISSED_STATUS.
Sourcepub fn user_reader_liveliness_status(&self, eid: EntityId) -> (bool, u64, u64)
pub fn user_reader_liveliness_status(&self, eid: EntityId) -> (bool, u64, u64)
Current liveliness status of a local user reader.
Spec §2.2.4.2.14 LIVELINESS_CHANGED_STATUS:
(alive, alive_count, not_alive_count).
Sourcepub fn user_writer_liveliness_lost(&self, eid: EntityId) -> u64
pub fn user_writer_liveliness_lost(&self, eid: EntityId) -> u64
LivelinessLost counter on the user writer (Spec §2.2.4.2.10).
Incremented by check_writer_liveliness.
Sourcepub fn user_writer_offered_incompatible_qos(
&self,
eid: EntityId,
) -> OfferedIncompatibleQosStatus
pub fn user_writer_offered_incompatible_qos( &self, eid: EntityId, ) -> OfferedIncompatibleQosStatus
Snapshot of OfferedIncompatibleQosStatus on the writer.
Sourcepub fn user_reader_requested_incompatible_qos(
&self,
eid: EntityId,
) -> RequestedIncompatibleQosStatus
pub fn user_reader_requested_incompatible_qos( &self, eid: EntityId, ) -> RequestedIncompatibleQosStatus
Snapshot of RequestedIncompatibleQosStatus on the reader.
Sourcepub fn user_reader_sample_lost(&self, eid: EntityId) -> u64
pub fn user_reader_sample_lost(&self, eid: EntityId) -> u64
Sample-lost counter (reader side). Spec §2.2.4.2.6.2.
Sourcepub fn user_reader_samples_delivered(&self, eid: EntityId) -> u64
pub fn user_reader_samples_delivered(&self, eid: EntityId) -> u64
Monotonically increasing count of alive samples delivered to the
user (Spec §2.2.4.2.6.1 on_data_available detector). A delta
against the last poll snapshot means “new data available”.
Sourcepub fn set_user_reader_time_based_filter(
&self,
eid: EntityId,
min_separation_nanos: u128,
) -> bool
pub fn set_user_reader_time_based_filter( &self, eid: EntityId, min_separation_nanos: u128, ) -> bool
A2 — arm TIME_BASED_FILTER (DDS 1.4 §2.2.3.12) on a runtime/C-FFI user
reader: it then receives at most one sample per instance per
min_separation_nanos; closer-spaced samples are dropped before they
reach the reader’s channel. 0 disables the filter. Returns true if
the reader exists. This is the seam rmw_zerodds uses to rate-limit ROS-2
subscriptions (rmw_qos_profile_t carries no TIME_BASED_FILTER field).
Sourcepub fn user_reader_unknown_src_count(&self, eid: EntityId) -> u64
pub fn user_reader_unknown_src_count(&self, eid: EntityId) -> u64
Bug-2 diagnosis (2026-05-19): number of submessages dropped because of an unknown writer_id. If this value is incremented after a write, it indicates an SEDP match race (writer_proxy not yet added when DATA is received).
Sourcepub fn user_reader_sample_rejected(&self, eid: EntityId) -> SampleRejectedStatus
pub fn user_reader_sample_rejected(&self, eid: EntityId) -> SampleRejectedStatus
Sample-rejected status (reader side). Spec §2.2.4.2.6.3.
Sourcepub fn record_sample_lost(&self, eid: EntityId, count: u32)
pub fn record_sample_lost(&self, eid: EntityId, count: u32)
Records a lost sample on the user reader. Called by resource-limit or decode-failure paths — the detector is application-external, because sample-lost depending on the implementation comes from several sources (cache drop, decode fail, sequence-number gap drop).
Sourcepub fn record_sample_rejected(
&self,
eid: EntityId,
kind: SampleRejectedStatusKind,
instance: InstanceHandle,
)
pub fn record_sample_rejected( &self, eid: EntityId, kind: SampleRejectedStatusKind, instance: InstanceHandle, )
Records a rejected sample on the user reader.
Sourcepub fn assert_writer_liveliness_eid(&self, eid: EntityId)
pub fn assert_writer_liveliness_eid(&self, eid: EntityId)
Manual liveliness assert on the user writer. Sets the
last_liveliness_assert timestamp. For LivelinessKind::Automatic
last_write is also set — the liveliness path
otherwise never falls through the assert trigger, because every successful
write already takes over the liveliness tick.
Sourcepub fn user_writer_all_acknowledged(&self, eid: EntityId) -> bool
pub fn user_writer_all_acknowledged(&self, eid: EntityId) -> bool
True if all matched readers have acknowledged all samples written so far. Empty cache or no proxies → true.
Sourcepub fn register_user_reader_waker(&self, eid: EntityId, waker: Option<Waker>)
pub fn register_user_reader_waker(&self, eid: EntityId, waker: Option<Waker>)
Spec §3.1 zerodds-async-1.0: registers the waker of an
async reader in the UserReaderSlot. On sample_tx.send
the waker is woken. None as the argument clears the waker
(e.g. after the async reader is dropped).
Sourcepub fn set_user_reader_listener(
&self,
eid: EntityId,
listener: Option<UserReaderListener>,
) -> bool
pub fn set_user_reader_listener( &self, eid: EntityId, listener: Option<UserReaderListener>, ) -> bool
Register a listener callback for alive-sample
arrival on the user reader. None clears an
existing listener.
The listener fires synchronously on the recv thread of
recv_user_data_loop — see the contract doc on the
UserReaderListener type. Eliminates the user-polling
latency (~50-100 µs) compared to sample_tx.recv().
Returns true if the reader slot exists and the listener
was set, false if the EID is not a known user reader.
Sourcepub fn user_reader_matched_count(&self, eid: EntityId) -> usize
pub fn user_reader_matched_count(&self, eid: EntityId) -> usize
Number of matched writers for a local user reader: remote/cross- participant writers (writer proxies) plus same-participant writers from the intra-runtime routes, deduplicated by GUID (symmetric to the writer).
Sourcepub fn wait_match_event(&self, timeout: Duration) -> bool
pub fn wait_match_event(&self, timeout: Duration) -> bool
D.5e Phase-1 — waits until a match event occurs or the timeout
is reached. Replaces 20-ms polling in DataReader::wait_for_matched_*
and DataWriter::wait_for_matched_*.
The caller checks the match count itself (via user_*_matched_count)
before and after the wait — this function is only the block mechanics.
Returns false if the timeout is reached, true if a notify came.
Sourcepub fn wait_ack_event(&self, timeout: Duration) -> bool
pub fn wait_ack_event(&self, timeout: Duration) -> bool
D.5e Phase-1 — waits until an ACK event occurs or a timeout.
Replaces 50-ms polling in DataWriter::wait_for_acknowledgments.
Sourcepub fn set_shm_locator(&self, eid: EntityId, bytes: Vec<u8>)
pub fn set_shm_locator(&self, eid: EntityId, bytes: Vec<u8>)
ADR-0006 — sets the PID_SHM_LOCATOR bytes for a local
user writer in the side map. Called by the DataWriter
once set_flat_backend has attached a same-host backend (POSIX shm /
Iceoryx2). On the next SEDP push the wire encoder
injects PID 0x8001 into the PublicationData.
Sourcepub fn shm_locator(&self, eid: EntityId) -> Option<Vec<u8>>
pub fn shm_locator(&self, eid: EntityId) -> Option<Vec<u8>>
ADR-0006 — reads the PID_SHM_LOCATOR bytes for a local
user writer from the side map. Returns None if no
same-host backend is set.
Sourcepub fn clear_shm_locator(&self, eid: EntityId)
pub fn clear_shm_locator(&self, eid: EntityId)
ADR-0006 — removes the PID_SHM_LOCATOR entry (e.g. when the user writer is reconfigured without a backend).
Sourcepub fn shutdown(&self)
pub fn shutdown(&self)
Stops all worker threads (recv loops + tick loop) and joins them. Idempotent — repeated calls are no-ops.
Shutdown delay: up to ~1 s, because the recv threads sit in
recv() with a 1 s read timeout. After the
current recv() call finishes they check the stop flag and
terminate.
Source§impl DcpsRuntime
impl DcpsRuntime
Sourcepub fn tick_count(&self) -> u64
pub fn tick_count(&self) -> u64
Number of completed tick iterations since start(). Advances once per
tick regardless of whether the internal zdds-tick thread or an
external executor (DcpsRuntime::tick_driver) drives it — a stalled
value means the periodic tick stopped. Diagnostic only.
Sourcepub fn spdp_announce_count(&self) -> u64
pub fn spdp_announce_count(&self) -> u64
Number of SPDP announces emitted since start(). Diagnostic for the C3
initial-announcement burst: a fresh participant with no discovered peer
advances this at RuntimeConfig::initial_announce_period for the first
RuntimeConfig::initial_announce_count announces, then slows to
spdp_period.
Sourcepub fn inconsistent_topic_count(&self) -> u64
pub fn inconsistent_topic_count(&self) -> u64
Number of discovered topic inconsistencies (DDS 1.4 §2.2.4.2.4).
Bumped during matching against the SEDP cache whenever a remote
endpoint carries the same topic_name but a differing type_name
than a local endpoint. A delta against the last poll snapshot
triggers on_inconsistent_topic.
Sourcepub fn tick_driver(self: &Arc<Self>) -> DcpsTickDriver
pub fn tick_driver(self: &Arc<Self>) -> DcpsTickDriver
External tick driver (zerodds-async-1.0 §4). Only meaningful when the
runtime was started with RuntimeConfig::external_tick = true,
which suppresses the dedicated zdds-tick thread. Each
DcpsTickDriver::tick call runs exactly one tick iteration; the
caller schedules the next after DcpsTickDriver::tick_period. The
async API’s spawn_in_tokio uses this to multiplex many participants’
tick loops onto a tokio runtime instead of one std::thread each.
Sourcepub fn raise_tick_wake(&self)
pub fn raise_tick_wake(&self)
D.5e Phase 3 — wake the scheduler tick worker immediately (new work:
a sample written, a HEARTBEAT/DATA/ACKNACK received). Coalesced: many
raises between two worker passes collapse into a single wake, so a
datagram storm does not flood the channel. No-op unless started with
scheduler_tick.