RTI Connext Modern C++ API Version 7.2.0
rti::core::PersistentStorageSettings Class Reference

<<extension>> Configures the persistent storage settings for durable writer history and durable reader state. More...

#include <rti/core/PolicySettings.hpp>

Public Member Functions

 PersistentStorageSettings ()
 Creates an instance with the default settings. More...
 
PersistentStorageSettingsenable (bool the_enable)
 Enables durable writer history in a dds::pub::DataWriter and durable reader state in a dds::sub::DataReader. More...
 
bool enable () const
 Getter (see setter with the same name). More...
 
PersistentStorageSettingsfile_name (const rti::core::optional_value< std::string > &the_file_name)
 Sets the file name where the durable writer history or durable reader state will be stored. More...
 
PersistentStorageSettingsfile_name (const char *the_file_name)
 Sets the file name where the durable writer history or durable reader state will be stored. More...
 
rti::core::optional_value< std::string > file_name () const
 Getter (see setter with the same name). More...
 
PersistentStorageSettingstrace_file_name (const rti::core::optional_value< std::string > &the_trace_file_name)
 Sets the file name where to store the SQL statements executed when loading and storing the durable writer history or durable reader state. More...
 
PersistentStorageSettingstrace_file_name (const char *the_trace_file_name)
 Sets the file name where to store the SQL statements executed when loading and storing the durable writer history or durable reader state. More...
 
rti::core::optional_value< std::string > trace_file_name () const
 Getter (see setter with the same name). More...
 
PersistentStorageSettingsjournal_kind (rti::core::policy::PersistentJournalKind the_journal_kind)
 Sets the journal mode of the persistent storage. More...
 
rti::core::policy::PersistentJournalKind journal_kind () const
 Getter (see setter with the same name). More...
 
PersistentStorageSettingssynchronization_kind (rti::core::policy::PersistentSynchronizationKind the_synchronization_kind)
 Sets the level of synchronization with the physical disk. More...
 
rti::core::policy::PersistentSynchronizationKind synchronization_kind () const
 Getter (see setter with the same name). More...
 
PersistentStorageSettingsvacuum (bool the_vacuum)
 Sets the auto-vacuum status of the storage. More...
 
bool vacuum () const
 Getter (see setter with the same name). More...
 
PersistentStorageSettingsrestore (bool the_restore)
 Indicates if the persisted writer history or reader state must be restored. More...
 
bool restore () const
 Getter (see setter with the same name). More...
 
PersistentStorageSettingswriter_instance_cache_allocation (const AllocationSettings &the_writer_instance_cache_allocation)
 Configures the resource limits associated with the instance durable writer history cache. More...
 
AllocationSettings writer_instance_cache_allocation () const
 Gets the writer instance cache allocation (see setter) More...
 
PersistentStorageSettingswriter_sample_cache_allocation (const AllocationSettings &the_writer_sample_cache_allocation)
 Configures the resource limits associated with the sample durable writer history cache. More...
 
AllocationSettings writer_sample_cache_allocation () const
 Gets the writer instance cache allocation (see setter) More...
 
PersistentStorageSettingswriter_memory_state (bool the_writer_memory_state)
 Determines how much state will be kept in memory by the durable writer history in order to avoid accessing the persistent storage in disk. More...
 
bool writer_memory_state () const
 Getter (see setter with the same name). More...
 
PersistentStorageSettingsreader_checkpoint_frequency (uint32_t the_reader_checkpoint_frequency)
 Controls how often the reader state is stored into the database. More...
 
uint32_t reader_checkpoint_frequency () const
 Getter (see setter with the same name). More...
 

Detailed Description

<<extension>> Configures the persistent storage settings for durable writer history and durable reader state.

In a dds::pub::DataWriter, this structure configures durable writer history. This feature allows a DataWriter to persist its historical cache, so that it can survive shutdowns, crashes, and restarts. When an application restarts, each DataWriter that has been configured to have durable writer history automatically loads all of the data in this cache from disk and can carry on sending data as if it had never stopped executing.

In a dds::sub::DataReader, this structure configures durable reader state. This feature allows a DataReader to persist its state and remember which data it has already received. When an application restarts, each DataReader that has been configured to have durable reader state automatically loads its state from disk and can carry on receiving data as if it had never stopped executing. Data that had already been received by the DataReader before the restart will be suppressed so that it is not even sent over the network.

RTI Connext uses SQLite to store the durable writer history and durable reader state.

QoS:
dds::core::policy::Durability

Constructor & Destructor Documentation

◆ PersistentStorageSettings()

rti::core::PersistentStorageSettings::PersistentStorageSettings ( )
inline

Creates an instance with the default settings.

Member Function Documentation

◆ enable() [1/2]

PersistentStorageSettings & rti::core::PersistentStorageSettings::enable ( bool  the_enable)

Enables durable writer history in a dds::pub::DataWriter and durable reader state in a dds::sub::DataReader.

When this field is set to true, the persistent storage configuration using this structure will take precedence over the configuration using the deprecated dds.data_writer.history.odbc_plugin.builtin.* and dds.data_reader.state.* properties.

[default] false

◆ enable() [2/2]

bool rti::core::PersistentStorageSettings::enable ( ) const

Getter (see setter with the same name).

◆ file_name() [1/3]

PersistentStorageSettings & rti::core::PersistentStorageSettings::file_name ( const rti::core::optional_value< std::string > &  the_file_name)

Sets the file name where the durable writer history or durable reader state will be stored.

Parameters
the_file_nameAn optional string. A value is required when enable is set to true.

Setting this field to a value other than NULL is mandatory when enabling durable writer history or durable reader state.

If the file does not exist, it will be created.

If the file exists and rti::core::PersistentStorageSettings::restore is set to true, the durable writer history or durable reader state will be restored from the file. Otherwise, the file will be overwritten.

Important: When the file exists, the fields rti::core::policy::DataReaderProtocol::virtual_guid and rti::core::policy::DataWriterProtocol::virtual_guid will be set by RTI Connext based on the file content. If you change these fields, the value will be ignored.

RTI Connext uses SQLite to store the durable writer history and durable reader state.

[default] NULL

◆ file_name() [2/3]

PersistentStorageSettings & rti::core::PersistentStorageSettings::file_name ( const char *  the_file_name)

Sets the file name where the durable writer history or durable reader state will be stored.

Parameters
the_file_nameThe file name. A value different other than NULL is required when enable is set to true.

Setting this field to a value other than NULL is mandatory when enabling durable writer history or durable reader state.

If the file does not exist, it will be created.

If the file exists and rti::core::PersistentStorageSettings::restore is set to true, the durable writer history or durable reader state will be restored from the file. Otherwise, the file will be overwritten.

Important: When the file exists, the fields rti::core::policy::DataReaderProtocol::virtual_guid and rti::core::policy::DataWriterProtocol::virtual_guid will be set by RTI Connext based on the file content. If you change these fields, the value will be ignored.

RTI Connext uses SQLite to store the durable writer history and durable reader state.

[default] NULL

◆ file_name() [3/3]

rti::core::optional_value< std::string > rti::core::PersistentStorageSettings::file_name ( ) const

Getter (see setter with the same name).

◆ trace_file_name() [1/3]

PersistentStorageSettings & rti::core::PersistentStorageSettings::trace_file_name ( const rti::core::optional_value< std::string > &  the_trace_file_name)

Sets the file name where to store the SQL statements executed when loading and storing the durable writer history or durable reader state.

Parameters
the_trace_file_nameAn optional string. When not set, no trace file will be generated.

Setting this field to a value other than NULL will enable tracing of the SQL statements executed when loading and storing the durable writer history or durable reader state.

Important: Enabling tracing will have a negative impact on performance. Use this feature only for debugging purposes.

[default] NULL

◆ trace_file_name() [2/3]

PersistentStorageSettings & rti::core::PersistentStorageSettings::trace_file_name ( const char *  the_trace_file_name)

Sets the file name where to store the SQL statements executed when loading and storing the durable writer history or durable reader state.

Parameters
the_trace_file_nameThe trace file name. When NULL, no trace file will be generated.

Setting this field to a value other than NULL will enable tracing of the SQL statements executed when loading and storing the durable writer history or durable reader state.

Important: Enabling tracing will have a negative impact on performance. Use this feature only for debugging purposes.

[default] NULL

◆ trace_file_name() [3/3]

rti::core::optional_value< std::string > rti::core::PersistentStorageSettings::trace_file_name ( ) const

Getter (see setter with the same name).

◆ journal_kind() [1/2]

PersistentStorageSettings & rti::core::PersistentStorageSettings::journal_kind ( rti::core::policy::PersistentJournalKind  the_journal_kind)

Sets the journal mode of the persistent storage.

Parameters
the_journal_kindThe journal kind.

[default] dds::core::policy::PersistentJournalKind::wal_journal

◆ journal_kind() [2/2]

rti::core::policy::PersistentJournalKind rti::core::PersistentStorageSettings::journal_kind ( ) const

Getter (see setter with the same name).

◆ synchronization_kind() [1/2]

PersistentStorageSettings & rti::core::PersistentStorageSettings::synchronization_kind ( rti::core::policy::PersistentSynchronizationKind  the_synchronization_kind)

Sets the level of synchronization with the physical disk.

Parameters
the_synchronization_kindThe synchronization kind.

[default] dds::core::policy::PersistentSynchronizationKind::normal

◆ synchronization_kind() [2/2]

rti::core::policy::PersistentSynchronizationKind rti::core::PersistentStorageSettings::synchronization_kind ( ) const

Getter (see setter with the same name).

◆ vacuum() [1/2]

PersistentStorageSettings & rti::core::PersistentStorageSettings::vacuum ( bool  the_vacuum)

Sets the auto-vacuum status of the storage.

When auto-vacuum is true, the storage files will be compacted automatically with every transaction.

When auto-vacuum is false, after data is deleted from the storage files, the files remain the same size.

[default] true

◆ vacuum() [2/2]

bool rti::core::PersistentStorageSettings::vacuum ( ) const

Getter (see setter with the same name).

◆ restore() [1/2]

PersistentStorageSettings & rti::core::PersistentStorageSettings::restore ( bool  the_restore)

Indicates if the persisted writer history or reader state must be restored.

For a dds::pub::DataWriter, this field indicates whether or not the persisted writer history must be restored once the DataWriter is restarted.

For a dds::sub::DataReader, this field indicates whether or not the persisted reader state must be restored once the DataReader is restarted.

[default] true

◆ restore() [2/2]

bool rti::core::PersistentStorageSettings::restore ( ) const

Getter (see setter with the same name).

◆ writer_instance_cache_allocation() [1/2]

PersistentStorageSettings & rti::core::PersistentStorageSettings::writer_instance_cache_allocation ( const AllocationSettings the_writer_instance_cache_allocation)

Configures the resource limits associated with the instance durable writer history cache.

This field only applies to dds::pub::DataWriter entities.

To minimize the number of accesses to the persisted storage, RTI Connext uses an instance cache.

Do not confuse this limit with the initial and maximum number of instances that can be maintained by a DataWriter in persistent storage. These resource limits are configured using dds::core::policy::ResourceLimits::max_instances and dds::core::policy::ResourceLimits::initial_instances.

If rti::core::PersistentStorageSettings::writer_memory_state is set to true, then the value of rti::core::AllocationSettings::max_count is set to dds::core::LENGTH_UNLIMITED, overwriting any value set by the user.

rti::core::AllocationSettings::incremental_count is ignored.

[range] rti::core::AllocationSettings::max_count in interval [1, INT_MAX], rti::core::LENGTH_AUTO, or dds::core::LENGTH_UNLIMITED. rti::core::AllocationSettings::initial_count in interval [1, INT_MAX], or rti::core::LENGTH_AUTO.

rti::core::LENGTH_AUTO means that the value will be set to the equivalent value of dds::core::policy::ResourceLimits.

[default] rti::core::AllocationSettings::max_count = rti::core::LENGTH_AUTO (= dds::core::policy::ResourceLimits::max_instances) and rti::core::AllocationSettings::initial_count = rti::core::LENGTH_AUTO (= dds::core::policy::ResourceLimits::initial_instances).

◆ writer_instance_cache_allocation() [2/2]

AllocationSettings rti::core::PersistentStorageSettings::writer_instance_cache_allocation ( ) const

Gets the writer instance cache allocation (see setter)

◆ writer_sample_cache_allocation() [1/2]

PersistentStorageSettings & rti::core::PersistentStorageSettings::writer_sample_cache_allocation ( const AllocationSettings the_writer_sample_cache_allocation)

Configures the resource limits associated with the sample durable writer history cache.

This field only applies to dds::pub::DataWriter entities.

To minimize the number of accesses to the persisted storage, RTI Connext uses a sample cache.

Do not confuse this limit with the initial and maximum number of samples that can be maintained by a DataWriter in persistent storage. These resource limits are configured using dds::core::policy::ResourceLimits::max_samples and dds::core::policy::ResourceLimits::initial_samples.

rti::core::AllocationSettings::incremental_count is ignored.

[range] rti::core::AllocationSettings::max_count in interval [1, INT_MAX], rti::core::LENGTH_AUTO, or dds::core::LENGTH_UNLIMITED. rti::core::AllocationSettings::initial_count in interval [1, INT_MAX], or rti::core::LENGTH_AUTO.

rti::core::LENGTH_AUTO means that the value will be set to the equivalent value of dds::core::policy::ResourceLimits.

[default] rti::core::AllocationSettings::max_count = 32 and rti::core::AllocationSettings::initial_count = 32.

◆ writer_sample_cache_allocation() [2/2]

AllocationSettings rti::core::PersistentStorageSettings::writer_sample_cache_allocation ( ) const

Gets the writer instance cache allocation (see setter)

◆ writer_memory_state() [1/2]

PersistentStorageSettings & rti::core::PersistentStorageSettings::writer_memory_state ( bool  the_writer_memory_state)

Determines how much state will be kept in memory by the durable writer history in order to avoid accessing the persistent storage in disk.

This field only applies to dds::pub::DataWriter entities.

If this field is set to true, then rti::core::AllocationSettings::max_count in rti::core::PersistentStorageSettings::writer_instance_cache_allocation is set to dds::core::LENGTH_UNLIMITED, overwriting any value set by the user.

In addition, the durable writer history will keep a fixed state overhead per sample in memory. This mode provides the best durable writer history performance. However, the restore operation will be slower, and the maximum number of samples that the durable writer history can manage is limited by the available physical memory.

If this field is set to false, all the state will be kept in the underlying database. In this mode, the maximum number of samples in the durable writer history is not limited by the physical memory available.

This field is always set to false when the DataWriter is configured with dds::core::policy::Reliability::acknowledgment_kind set to rti::core::policy::AcknowledgmentKind_def::APPLICATION_AUTO or rti::core::policy::AcknowledgmentKind_def::APPLICATION_EXPLICIT, or rti::core::policy::Availability::enable_required_subscriptions is set to true.

[default] true

◆ writer_memory_state() [2/2]

bool rti::core::PersistentStorageSettings::writer_memory_state ( ) const

Getter (see setter with the same name).

◆ reader_checkpoint_frequency() [1/2]

PersistentStorageSettings & rti::core::PersistentStorageSettings::reader_checkpoint_frequency ( uint32_t  the_reader_checkpoint_frequency)

Controls how often the reader state is stored into the database.

This field only applies to dds::sub::DataReader entities.

A value of N means store the state once every N received and processed samples.

The circumstances under which a data sample is considered "processed by the application" depends on the DataReader configuration.

For additional information on when a sample is considered "processed by the application" see Durable Reader State, in the Core Libraries User's Manual.

A high value will provide better performance. However, if the DataReader is restarted it may receive some duplicate samples.

[range] [1, 1000000] [default] 1

◆ reader_checkpoint_frequency() [2/2]

uint32_t rti::core::PersistentStorageSettings::reader_checkpoint_frequency ( ) const

Getter (see setter with the same name).