RTI Connext C API Version 7.7.0
DDS_LifespanQosPolicy Struct Reference

<<spec>> Specifies how long the data written by the DDS_DataWriter is considered valid. More...

Data Fields

struct DDS_Duration_t duration
 <<basic>> <<spec>> Maximum duration for the data's validity. More...
 
DDS_Boolean use_source_timestamp
 <<extension>> Whether lifespan duration starts at the source timestamp. More...
 

Detailed Description

<<spec>> Specifies how long the data written by the DDS_DataWriter is considered valid.

Each data sample written by the DDS_DataWriter has an associated expiration time beyond which the data should not be delivered to any application. Once the sample expires, the data will be removed from the DDS_DataReader caches as well as from the transient and persistent information caches.

The DDS_LifespanQosPolicy::use_source_timestamp field determines how the expiration time of each sample is computed.

See also
FooDataWriter_write
FooDataWriter_write_w_timestamp
Entity:
DDS_Topic, DDS_DataReader, DDS_DataWriter
Properties:
RxO = N/A
Changeable = YES

Usage

The Lifespan QoS policy can be used to control how much data is stored by RTI Connext. Even if it is configured to store "all" of the data sent or received for a topic (see DDS_HistoryQosPolicy), the total amount of data it stores may be limited by this QoS policy.

You may also use this QoS policy to ensure that applications do not receive or act on data, commands or messages that are too old and have 'expired.'

To avoid inconsistencies, multiple writers of the same instance should have the same lifespan.

See also
DDS_SampleInfo::source_timestamp
DDS_SampleInfo::reception_timestamp

Field Documentation

◆ duration

struct DDS_Duration_t DDS_LifespanQosPolicy::duration

<<basic>> <<spec>> Maximum duration for the data's validity.

Setting duration to a finite value is allowed only on the DataWriter side. Its value will be propagated to the DataReader side during endpoint discovery.

[default] DDS_DURATION_INFINITE

[range] [1 nanosec, 1 year] or DDS_DURATION_INFINITE

Categories
Mutable, Discovery Metadata, Durability, Data Availability

◆ use_source_timestamp

DDS_Boolean DDS_LifespanQosPolicy::use_source_timestamp

<<extension>> Whether lifespan duration starts at the source timestamp.

If set to DDS_BOOLEAN_TRUE, the expiration time of each sample from either the DDS_DataWriter or the DDS_DataReader's cache is computed by adding the duration specified by this QoS policy to the sample's source timestamp, which you can optionally provide using the FooDataWriter_write_w_timestamp or FooDataWriter_write_w_params API. On the DDS_DataReader side, it is possible for a sample to be expired immediately upon reception. If this immediate expiration happens to a dispose or unregister message, then the dispose or unregister message has no effect. Setting this to DDS_BOOLEAN_TRUE makes your application more compliant with the DDS Specification, which says "The 'expiration time' of each sample is computed by adding the duration specified by the LIFESPAN QoS to the source timestamp." Setting this to DDS_BOOLEAN_TRUE on the DataReader also prevents delivery of expired repair samples from a non-compliant DataWriter.

Warning
As mentioned in Clock Selection Strategy, in the Core Libraries User's Manual, you should not use the monotonic clock for the external clock if you are relying on source timestamps. If the DataReader is on a different machine than the DataWriter, then there is no correlation between the source timestamp from a monotonic clock on the DataWriter's machine and the time on the DataReader's machine. This mismatch can cause samples to be erroneously expired or kept alive.

If set to DDS_BOOLEAN_FALSE on the DDS_DataWriter, the expiration time of each sample from the DDS_DataWriter's cache is computed by adding the duration specified by this QoS policy to the time when the sample is added to the DDS_DataWriter's cache. This timestamp is not necessarily equal to the sample's source timestamp, which can be provided by the user using the FooDataWriter_write_w_timestamp or FooDataWriter_write_w_params API.

If set to DDS_BOOLEAN_FALSE on the DDS_DataReader, the expiration time of each sample from the DDS_DataReader's cache is computed by adding the duration to the reception timestamp.

[default] DDS_BOOLEAN_FALSE

Categories
Immutable, Durability, Data Availability