OpenDDS  Snapshot(2023/04/28-20:55)
PersistenceUpdater.h
Go to the documentation of this file.
1 /*
2  *
3  *
4  * Distributed under the OpenDDS License.
5  * See: http://www.opendds.org/license.html
6  */
7 
8 #ifndef PERSISTENCE_UPDATER_H
9 #define PERSISTENCE_UPDATER_H
10 
11 #include "inforepo_export.h"
12 #include "Updater.h"
13 
14 #include "dds/DdsDcpsInfoUtilsC.h"
15 #include "dds/DCPS/unique_ptr.h"
16 
17 #include "ace/Task.h"
19 #include "ace/Malloc_T.h"
20 #include "ace/MMAP_Memory_Pool.h"
21 #include "ace/Service_Object.h"
22 #include "ace/Service_Config.h"
23 
24 #include <string>
25 
27 
28 namespace Update {
29 
30 // Forward declaration
31 class Manager;
32 
34 public:
35  class IdType_ExtId {
36  public:
37  IdType_ExtId();
38 
39  IdType_ExtId(IdType id);
40 
41  IdType_ExtId(const IdType_ExtId& ext);
42 
43  void operator= (const IdType_ExtId& ext);
44 
45  bool operator== (const IdType_ExtId& ext) const;
46 
47  unsigned long hash() const;
48 
49  private:
51  };
52 
53 public:
56 
57  /// Persisted topic data structure
58  typedef struct TopicStrt <QosSeq, ACE_CString> Topic;
59 
60  /// Persisted participant data structure
62 
63  /// Persisted actor data structure
64  typedef struct ActorStrt <QosSeq, QosSeq, ACE_CString,
66  BinSeq> RWActor;
67 
71 
72 public:
74  virtual ~PersistenceUpdater();
75 
76  /// Service object initialization
77  virtual int init(int argc, ACE_TCHAR *argv[]);
78 
79  /// ACE_Task_Base finish method
80  virtual int fini();
81 
82  /// ACE_Task_Base start method
83  virtual int svc();
84 
85  /// Request an image refresh to be sent upstream.
86  /// This is currently done synchronously.
87  /// TBD: Move to an asynchronous model
88  virtual void requestImage();
89 
90  /// Add topic to be persisted.
91  virtual void create(const UTopic& topic);
92 
93  /// Add participant to be persisted.
94  virtual void create(const UParticipant& participant);
95 
96  /// Add DataReader to be persisted.
97  virtual void create(const URActor& actor);
98 
99  /// Add DataWriter to be persisted.
100  virtual void create(const UWActor& actor);
101 
102  /// Add ownership data to be persisted.
103  virtual void create(const OwnershipData& data);
104 
105  /// Persist updated Qos parameters for a Participant.
106  virtual void update(const IdPath& id, const DDS::DomainParticipantQos& qos);
107 
108  /// Persist updated Qos parameters for a Topic.
109  virtual void update(const IdPath& id, const DDS::TopicQos& qos);
110 
111  /// Persist updated Qos parameters for a DataWriter.
112  virtual void update(const IdPath& id, const DDS::DataWriterQos& qos);
113 
114  /// Persist updated Qos parameters for a Publisher.
115  virtual void update(const IdPath& id, const DDS::PublisherQos& qos);
116 
117  /// Persist updated Qos parameters for a DataReader.
118  virtual void update(const IdPath& id, const DDS::DataReaderQos& qos);
119 
120  /// Persist updated Qos parameters for a Subscriber.
121  virtual void update(const IdPath& id, const DDS::SubscriberQos& qos);
122 
123  /// Persist updated subscription exprParams.
124  virtual void update(const IdPath& id, const DDS::StringSeq& exprParams);
125 
126  /// Remove an entity (but not children) from persistence.
127  virtual void destroy(const IdPath& id, ItemType type, ActorType actor);
128 
129  /// Update Last Participant Id for repo
130  virtual void updateLastPartId(PartIdType partId);
131 
132 private:
133  int parse(int argc, ACE_TCHAR *argv[]);
134  void storeUpdate(const ACE_Message_Block& data, BinSeq& storage);
135 
137  bool reset_;
138 
140 
142 
143  /// Persisted Topics
144  TopicIndex *topic_index_;
145 
146  /// Persisted Participants
147  ParticipantIndex *participant_index_;
148 
149  /// Persisted Readers and Writers
150  ActorIndex *actor_index_;
151 
152  /// What the last participant id is/was
154 };
155 
156 } // End of namespace Update
157 
159 
161 
162 ACE_FACTORY_DECLARE(ACE_Local_Service, PersistenceUpdaterSvc)
163 
165 public:
166  static int init();
167 };
168 
169 #if defined(ACE_HAS_BROKEN_STATIC_CONSTRUCTORS)
170 
171 typedef int (*PersistenceUpdaterSvc_Loader)();
172 
174 
175 #else
176 
178 
179 #endif /* ACE_HAS_BROKEN_STATIC_CONSTRUCTORS */
180 
182 
183 #endif /* PERSISTENCE_UPDATER_H */
static int load
int hash(const std::vector< const DDS::OctetSeq *> &src, DDS::OctetSeq &dst)
TopicIndex * topic_index_
Persisted Topics.
PartIdType * last_part_id_
What the last participant id is/was.
long PartIdType
ACE_Hash_Map_With_Allocator< IdType_ExtId, Topic * > TopicIndex
std::pair< size_t, char * > BinSeq
#define ACE_STATIC_SVC_DECLARE(SERVICE_CLASS)
ACE_Allocator_Adapter< ACE_Malloc< ACE_MMAP_MEMORY_POOL, TAO_SYNCH_MUTEX > > ALLOCATOR
bool operator==(const DisjointSequence::OrderedRanges< T > &a, const DisjointSequence::OrderedRanges< T > &b)
#define OpenDDS_InfoRepoLib_Export
ACE_Hash_Map_With_Allocator< IdType_ExtId, Participant * > ParticipantIndex
std::pair< SpecificQos, BinSeq > QosSeq
Update::PersistenceUpdater PersistenceUpdaterSvc
char ACE_TCHAR
ParticipantIndex * participant_index_
Persisted Participants.
int init(void)
ACE_Hash_Map_With_Allocator< IdType_ExtId, RWActor * > ActorIndex
#define ACE_MMAP_MEMORY_POOL
ActorIndex * actor_index_
Persisted Readers and Writers.
#define ACE_FACTORY_DECLARE(CLS, SERVICE_CLASS)
int fini(void)
OpenDDS::DCPS::unique_ptr< ALLOCATOR > allocator_
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
#define TAO_SYNCH_MUTEX
sequence< string > StringSeq
Definition: DdsDcpsCore.idl:50