OpenDDS
Snapshot(2023/04/07-19:43)
|
Underlying data cache for both OpenDDS TRANSIENT
and PERSISTENT
DURABILITY
implementations..
More...
#include <DataDurabilityCache.h>
Classes | |
class | key_type |
Key type for underlying maps. More... | |
class | sample_data_type |
Sample list data type for all samples. More... | |
Public Types | |
typedef DurabilityArray< DurabilityQueue< sample_data_type > * > | sample_list_type |
typedef ACE_Hash_Map_With_Allocator< key_type, sample_list_type * > | sample_map_type |
Public Member Functions | |
typedef | OPENDDS_LIST (long) timer_id_list_type |
DataDurabilityCache (DDS::DurabilityQosPolicyKind kind) | |
DataDurabilityCache (DDS::DurabilityQosPolicyKind kind, ACE_CString &data_dir) | |
~DataDurabilityCache () | |
bool | insert (DDS::DomainId_t domain_id, char const *topic_name, char const *type_name, SendStateDataSampleList &the_data, DDS::DurabilityServiceQosPolicy const &qos) |
bool | get_data (DDS::DomainId_t domain_id, char const *topic_name, char const *type_name, DataWriterImpl *data_writer, ACE_Allocator *mb_allocator, ACE_Allocator *db_allocator, DDS::LifespanQosPolicy const &) |
Private Member Functions | |
DataDurabilityCache (DataDurabilityCache const &) | |
DataDurabilityCache & | operator= (DataDurabilityCache const &) |
void | init () |
Private Attributes | |
unique_ptr< ACE_Allocator > const | allocator_ |
Allocator used to allocate memory for sample map and lists. More... | |
DDS::DurabilityQosPolicyKind | kind_ |
ACE_CString | data_dir_ |
sample_map_type * | samples_ |
Map of all data samples. More... | |
timer_id_list_type | cleanup_timer_ids_ |
Timer ID list. More... | |
ACE_SYNCH_MUTEX | lock_ |
Lock for synchronized access to the underlying map. More... | |
ACE_Reactor_Timer_Interface * | reactor_ |
Reactor with which cleanup timers will be registered. More... | |
Underlying data cache for both OpenDDS TRANSIENT
and PERSISTENT
DURABILITY
implementations..
This class implements a cache that outlives DataWriters
.
Definition at line 69 of file DataDurabilityCache.h.
typedef DurabilityArray< DurabilityQueue<sample_data_type> *> OpenDDS::DCPS::DataDurabilityCache::sample_list_type |
Definition at line 184 of file DataDurabilityCache.h.
typedef ACE_Hash_Map_With_Allocator<key_type, sample_list_type *> OpenDDS::DCPS::DataDurabilityCache::sample_map_type |
Definition at line 187 of file DataDurabilityCache.h.
OpenDDS::DCPS::DataDurabilityCache::DataDurabilityCache | ( | DDS::DurabilityQosPolicyKind | kind | ) |
Definition at line 287 of file DataDurabilityCache.cpp.
References init().
OpenDDS::DCPS::DataDurabilityCache::DataDurabilityCache | ( | DDS::DurabilityQosPolicyKind | kind, |
ACE_CString & | data_dir | ||
) |
Definition at line 299 of file DataDurabilityCache.cpp.
References init().
OpenDDS::DCPS::DataDurabilityCache::~DataDurabilityCache | ( | ) |
Definition at line 427 of file DataDurabilityCache.cpp.
References ACE_DES_FREE, allocator_, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_Null_Mutex >::begin(), ACE_Reactor_Timer_Interface::cancel_timer(), cleanup_timer_ids_, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_Null_Mutex >::end(), ACE_Allocator::free(), OpenDDS::DCPS::unique_ptr< T, Deleter >::get(), OPENDDS_MAP_TYPE, reactor_, samples_, and ACE_Array_Base< T >::size().
|
private |
bool OpenDDS::DCPS::DataDurabilityCache::get_data | ( | DDS::DomainId_t | domain_id, |
char const * | topic_name, | ||
char const * | type_name, | ||
DataWriterImpl * | data_writer, | ||
ACE_Allocator * | mb_allocator, | ||
ACE_Allocator * | db_allocator, | ||
DDS::LifespanQosPolicy const & | |||
) |
Write cached data corresponding to given domain, topic and type to DataWriter
.
Definition at line 718 of file DataDurabilityCache.cpp.
References ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY, ACE_ERROR, ACE_GUARD_RETURN, ACE_NEW_MALLOC_RETURN, ACE_SYNCH_MUTEX, ACE_TEXT(), ACE_Array_Base< T >::allocator_, allocator_, OpenDDS::DCPS::DCPS_debug_level, ACE_Hash_Map_With_Allocator< class, class >::find(), OpenDDS::DCPS::unique_ptr< T, Deleter >::get(), OpenDDS::DCPS::DataWriterImpl::get_db_lock(), OpenDDS::DCPS::DataDurabilityCache::sample_data_type::get_sample(), DDS::HANDLE_NIL, LM_ERROR, lock_, ACE_Allocator::malloc(), ACE_Time_Value::max_time, ACE_Message_Block::MB_DATA, ACE_OS::memcpy(), OpenDDS::DCPS::move(), OpenDDS::DCPS::DataWriterImpl::register_instance_from_durable_data(), DDS::RETCODE_OK, samples_, ACE_Array_Base< T >::size(), ACE_Message_Block::wr_ptr(), OpenDDS::DCPS::DataWriterImpl::write(), and ACE_Time_Value::zero.
|
private |
Definition at line 313 of file DataDurabilityCache.cpp.
References ACE_ERROR, ACE_NEW_MALLOC, ACE_TEXT(), allocator_, ACE_OS::atoi(), ACE_Hash_Map_With_Allocator< class, class >::bind(), ACE_String_Base< char >::c_str(), ACE_Message_Block::cont(), data_dir_, OpenDDS::DCPS::DCPS_debug_level, OpenDDS::DCPS::unique_ptr< T, Deleter >::get(), kind_, LM_ERROR, ACE_Allocator::malloc(), DDS::Time_t::nanosec, OPENDDS_STRING, OpenDDS::DCPS::OPENDDS_VECTOR(), DDS::PERSISTENT_DURABILITY_QOS, reactor_, ACE_Message_Block::release(), samples_, DDS::Time_t::sec, ACE_Array_Base< T >::size(), ACE_Message_Block::space(), TheServiceParticipant, timestamp(), and ACE_Message_Block::wr_ptr().
Referenced by DataDurabilityCache().
bool OpenDDS::DCPS::DataDurabilityCache::insert | ( | DDS::DomainId_t | domain_id, |
char const * | topic_name, | ||
char const * | type_name, | ||
SendStateDataSampleList & | the_data, | ||
DDS::DurabilityServiceQosPolicy const & | qos | ||
) |
Insert the samples corresponding to the given topic instance (uniquely identify by its domain, topic name and type name) into the data durability cache.
Definition at line 474 of file DataDurabilityCache.cpp.
References ACE_DEBUG, ACE_DES_FREE, ACE_ERROR, ACE_GUARD_RETURN, ACE_NEW_MALLOC_RETURN, ACE_SYNCH_MUTEX, ACE_TEXT(), allocator_, OpenDDS::DCPS::SendStateDataSampleList::begin(), ACE_Hash_Map_With_Allocator< class, class >::bind(), ACE_String_Base< char >::c_str(), cleanup_timer_ids_, OpenDDS::DCPS::COHERENT_CHANGE_FLAG, data_dir_, OpenDDS::DCPS::DCPS_debug_level, OpenDDS::DCPS::SendStateDataSampleList::end(), ACE_Hash_Map_With_Allocator< class, class >::find(), ACE_Allocator::free(), OpenDDS::DCPS::unique_ptr< T, Deleter >::get(), OpenDDS::DCPS::DataSampleElement::get_sample(), OpenDDS::DCPS::DataDurabilityCache::sample_data_type::get_sample(), DDS::DurabilityServiceQosPolicy::history_depth, DDS::DurabilityServiceQosPolicy::history_kind, OpenDDS::DCPS::TimeDuration::is_zero(), DDS::KEEP_ALL_HISTORY_QOS, kind_, DDS::LENGTH_UNLIMITED, LM_DEBUG, LM_ERROR, lock_, ACE_Allocator::malloc(), DDS::DurabilityServiceQosPolicy::max_samples_per_instance, DDS::Time_t::nanosec, OPENDDS_STRING, OpenDDS::DCPS::OPENDDS_VECTOR(), DDS::PERSISTENT_DURABILITY_QOS, reactor_, samples_, ACE_Reactor_Timer_Interface::schedule_timer(), DDS::Time_t::sec, DDS::DurabilityServiceQosPolicy::service_cleanup_delay, OpenDDS::DCPS::SendStateDataSampleList::size(), OpenDDS::DCPS::DataSampleHeader::test_flag(), timestamp(), OpenDDS::DCPS::to_dds_string(), and OpenDDS::DCPS::TimeDuration::value().
Referenced by OpenDDS::DCPS::WriteDataContainer::persist_data().
typedef OpenDDS::DCPS::DataDurabilityCache::OPENDDS_LIST | ( | long | ) |
|
private |
|
private |
Allocator used to allocate memory for sample map and lists.
Definition at line 227 of file DataDurabilityCache.h.
Referenced by get_data(), init(), insert(), and ~DataDurabilityCache().
|
private |
Timer ID list.
Keep track of cleanup timer IDs in case we need to cancel before they expire.
Definition at line 241 of file DataDurabilityCache.h.
Referenced by insert(), and ~DataDurabilityCache().
|
private |
Definition at line 231 of file DataDurabilityCache.h.
|
private |
Definition at line 229 of file DataDurabilityCache.h.
|
private |
Lock for synchronized access to the underlying map.
Definition at line 244 of file DataDurabilityCache.h.
Referenced by get_data(), and insert().
|
private |
Reactor with which cleanup timers will be registered.
Definition at line 247 of file DataDurabilityCache.h.
Referenced by init(), insert(), and ~DataDurabilityCache().
|
private |
Map of all data samples.
Definition at line 234 of file DataDurabilityCache.h.
Referenced by get_data(), init(), insert(), and ~DataDurabilityCache().