Skip to main content

ParticipantConfig

Struct ParticipantConfig 

Source
pub struct ParticipantConfig {
    pub udp: UdpConfig,
    pub announce_period: Duration,
    pub lease_duration: Duration,
    pub writer: WriterConfig,
    pub reader: ReaderConfig,
    pub drop_one_in: Option<u32>,
    pub user_data: Vec<u8>,
    pub shared_memory: bool,
    pub user_multicast: bool,
    pub persistence_directory: Option<PathBuf>,
}
Expand description

Settings of a DomainParticipant.

Fields§

§udp: UdpConfig

The UDP settings: interfaces, port numbers, participant id.

§announce_period: Duration

How often the participant announces itself (SPDP).

§lease_duration: Duration

How long other participants keep this one without hearing from it (SPDP lease duration).

§writer: WriterConfig

The timing of the user writers (HEARTBEAT period, NACK response delay, message size; DDSI-RTPS 2.5, 8.4.7.1).

§reader: ReaderConfig

The timing of the reliable user readers (HEARTBEAT response delay, 8.4.10.1).

§drop_one_in: Option<u32>

For testing: drop user-traffic datagrams received (DATA, HEARTBEAT, GAP, ACKNACK) at random, one in n on average, as if they were lost on the way. None, the default, drops nothing.

§user_data: Vec<u8>

USER_DATA of the participant (DDS 1.4, 2.2.3.1): octets announced to the other participants with SPDP. Empty by default. ROS 2 announces enclave=/; here.

§shared_memory: bool

Whether to exchange messages with the participants of rustorb-dds on this host through shared memory rather than UDP (feature shm; true by default). Others are reached by UDP either way.

§user_multicast: bool

Whether SPDP announces a defaultMulticastLocatorList (the multicast group on the user multicast port), so that remote writers may send user data to this participant’s readers by multicast. False by default, as in Fast DDS: an implementation that prefers multicast when it is offered (RustDDS) then sends to one reader on this host through multicast loopback, in small datagrams, at two to four times the round trip of unicast (#125).

§persistence_directory: Option<PathBuf>

The directory of the files in which PERSISTENT writers keep their samples. None, the default, is the RUSTORB_DDS_PERSISTENCE_DIR environment variable when it is set, and otherwise rustorb-dds-persistent in the current directory. The property Self::PERSISTENCE_DIRECTORY sets it too.

Implementations§

Source§

impl ParticipantConfig

Source

pub const PERSISTENCE_DIRECTORY: &'static str = "rustorb.dds.persistence.directory"

The property that sets Self::persistence_directory.

Source

pub fn new(domain_id: u32) -> Self

The defaults for a domain: the system’s interfaces, the default ports, an announcement every 3 s and a lease of 20 s.

The announcement period is shorter than SPDP’s suggested 30 s so that participants find each other quickly in a small domain. Writers send a HEARTBEAT every 200 ms while some reliable reader has not acknowledged everything, and ask the readers to acknowledge every 16 samples and 1 ms after the last one, not each sample.

Source

pub fn effective_persistence_directory(&self) -> PathBuf

The directory of the files of PERSISTENT writers, as Self::persistence_directory says.

Source

pub fn localhost(domain_id: u32) -> Self

Only this host: every socket on the loopback interface.

Source

pub fn set_properties<'a>( &mut self, properties: impl IntoIterator<Item = (&'a str, &'a str)>, ) -> Result<()>

Takes the PROPERTY of a DomainParticipantQos (DDS Security 1.2, 7.2.5), as the bindings for other languages give it: the dds.sec.* properties turn on DDS Security with the builtin plugins (SecurityConfig::from_properties); the dds.sec.crypto.rtps_psk_* ones and dds.sec.access.rtps_psk_protection_kind set [Self::psk] (alone, they choose the PSK plugins); Self::PERSISTENCE_DIRECTORY sets Self::persistence_directory; the others are ignored.

Fails with Error::Security when some but not all of the dds.sec.auth.* and dds.sec.access.* properties are given, and with Error::Unsupported when there are dds.sec.* properties and the feature security is off.

Trait Implementations§

Source§

impl Clone for ParticipantConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ParticipantConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.