Expand description
Same-host tracker for Wave 4 of the zero-copy roadmap
(Spec docs/specs/zerodds-zero-copy-1.0.md §6 Wave 3).
§Purpose
Discovery detects via [GuidPrefix::is_same_host] (Wave 4a) whether
a peer runs on the same machine. On a match, the DCPS runtime
registers a (WriterGuid, ReaderGuid) pair in this tracker. The
tracker keeps a deterministic SHM-segment identification so that both
sides can derive the same transport path without an extra discovery
round-trip.
§Path convention
An SHM segment for a writer-reader pair is identified by a
deterministic 16-byte hash of the two GUIDs (see
shm_segment_id_for_pair). Both sides arrive at the same id because
the hash is symmetric / ordered.
The base_dir default is ${TMPDIR}/zerodds-shm (Linux) or
${TEMP}\zerodds-shm (Windows). The host_id_hex sub-folder prevents
cross-host collisions on NFS mounts; should gethostname fail
(fallback in participant::host_id_bytes), the path remains unique
per process.
§Tracker state
Each pair has a SameHostState:
Pending— match detected, SHM setup not yet performed (e.g. because the Wave-4b.2 hook only maps the segment on the first send).Bound { transport, role }— SHM transport is initialized;rolesays which side is Owner (writer producer) or Consumer (reader receiver) (seeRole).Failed { reason }— setup failed; the sender should fall back to the classic UDP path.
The concrete transport instantiation does not live here (that is
the job of the Wave-4b.2 hook in the runtime module), so this module
stays no_std + alloc portable and does not depend directly on
transport-shm.
§Spec anchors
docs/specs/zerodds-zero-copy-1.0.md§6 Wave 3 (Iceoryx backend hot-path wiring; ZeroDDS reuses it for the SHM-bytes path).- RTPS 2.5 §9.4 —
LOCATOR_KIND_SHM.
Structs§
- Same
Host Tracker - Tracker for all
(WriterGuid, ReaderGuid)same-host pairs of the local participant. Thread-safe via an inner mutex.
Enums§
- Role
- Role of the local endpoint in the SHM pair.
- Same
Host State - State of a same-host pair in the tracker.
Constants§
- DEFAULT_
BASE_ DIR_ NAME - Default base directory for SHM segments. Used only in
stdbuilds; in theno_stdprofile the tracker is state-only and no path lookup is needed.
Functions§
- shm_
segment_ filename - Hex representation of a
shm_segment_id_for_pairresult. Returns 32 lowercase hex characters. - shm_
segment_ id_ for_ pair - Deterministic 16-byte segment identification for a writer-reader pair.