Skip to main content

Module shm

Module shm 

Source
Expand description

A shared memory transport for participants of rustorb-dds on the same host (feature shm).

Each participant has a receive segment: a file in a shared memory directory (/dev/shm on Linux, else the temporary directory), mapped by every process that sends to it, holding a ring buffer of RTPS messages; and a UDP socket on the loopback interface, whose port the segment gives, that senders ring after writing. Senders take turns through a lock in the segment. A message that does not fit is dropped, like a datagram lost on the way: the reliable protocol repairs it.

The participant announces its segment with locators of the vendor kind Locator::KIND_SHM (the address holds the host and the segment, the port tells metatraffic from user traffic), besides its UDP ones. Other implementations ignore them. A sender uses a peer’s shared memory locator when the host is its own and it can open the segment; else the peer’s UDP locators (ShmTransport::select).

Structs§

Pool
A pool of samples in shared memory, made by a writer for the samples it loans (zero-copy): fixed-size slots that the writer fills and the readers of this host map and read in place. A slot is reused once no one holds a reference to it: the writer, while the sample is in its history, and each reader, while it has the sample.
PoolLoan
A reference to a published sample of a Pool: the slot is not reused while one is alive. Cloning takes another reference.
PoolSlot
A slot the writer holds alone, to fill before it publishes it.
Pools
The pools of other writers that a reader opened, by id: each is kept mapped while its file exists.
ShmConfig
How the transport is set up.
ShmTransport
The shared memory transport of one participant.

Constants§

PORT_METATRAFFIC
The port of a shared memory locator for metatraffic.
PORT_USER
The port of a shared memory locator for user traffic.
REFERENCE_ENCAPSULATION
The encapsulation identifier of a payload that is a reference to a sample in a pool, not the sample: a vendor value, sent only to participants of rustorb-dds on this host.

Functions§

is_reference
Whether a payload is a reference to a pooled sample.