RTC Toolkit 5.0.0
Loading...
Searching...
No Matches
persistentRepoAdapter.hpp
Go to the documentation of this file.
1
13#ifndef RTCTK_COMPONENTFRAMEWORK_PERSISTENTREPOADAPTER_HPP
14#define RTCTK_COMPONENTFRAMEWORK_PERSISTENTREPOADAPTER_HPP
15
16#include <atomic>
17#include <functional>
18#include <memory>
19#include <mutex>
20#include <string>
21#include <tuple>
22#include <typeindex>
23#include <typeinfo>
24#include <unordered_map>
25#include <utility>
26
27#include <mal/utility/Uri.hpp>
28
34
36
56public:
57 inline static const std::string SUPPORTED_URI_SCHEME = "cii.config";
58
65 public:
66 explicit ServiceFailureException(const DataPointPath& path);
67 };
68
73 public:
74 explicit InvalidDocumentException(const DataPointPath& path, const elt::mal::Uri& uri);
75 explicit InvalidDocumentException(const DataPointPath& path,
76 const elt::mal::Uri& uri,
77 const std::string& message);
78 };
79
84 public:
85 explicit PathMissingException(const DataPointPath& path);
86 };
87
90
93
96
99
102
113 explicit PersistentRepoAdapter(const elt::mal::Uri& baseuri, bool simple_layout = false);
114
122 elt::mal::Uri GetBaseUri() const {
123 return m_path_mapper.GetBaseUri();
124 }
125
126 virtual ~PersistentRepoAdapter() = default;
127
133 uint64_t GetFitsWriteThreshold() const {
134 return m_fits_write_threshold;
135 }
136
141 void SetFitsWriteThreshold(uint64_t value) {
142 m_fits_write_threshold = value;
143 }
144
145private:
146 template <typename T>
147 void CreateImpl(detail::CreateRequest<T>& request);
148
149 template <typename T>
150 void ReadImpl(detail::ReadRequest<T>& request);
151
152 template <typename T>
153 void WriteImpl(detail::WriteRequest<T>& request);
154
155 template <typename T>
156 void PartialReadImpl(detail::PartialReadRequest<T>& request);
157
158 template <typename T>
159 void PartialWriteImpl(detail::PartialWriteRequest<T>& request);
160
161 void ReadMetaDataImpl(detail::ReadMetaDataRequest& request);
162 void WriteMetaDataImpl(detail::WriteMetaDataRequest& request);
163 void DeleteImpl(detail::DeleteRequest& request);
164 void ExistsImpl(detail::ExistsRequest& request);
165 void GetChildrenImpl(detail::GetChildrenRequest& request);
166 void CreateLinkImpl(detail::CreateSymlinkRequest& request);
167 void UpdateLinkImpl(detail::UpdateSymlinkRequest& request);
168
169 BatchResponse ProcessRequests(const RequestList& requests) override;
170
171 void GetChildren(const DataPointPath& path, PathList& datapoints, PathList& childpaths) const;
172
178 void FillExtraMetadata(MetaData& metadata, const DataPointPath& path);
179
193 template <typename T>
194 static void CheckBufferAndDataPointTypesMatch(const std::type_info& type, const T* node);
195
196 log4cplus::Logger& m_logger;
197
202 std::atomic<uint64_t> m_fits_write_threshold;
203
208 mutable std::mutex m_mutex;
209
211 PathMapper m_path_mapper;
212
213 RTCTK_LOCAL static const std::type_info& LookupCppType(const std::string& tag);
214 RTCTK_LOCAL static std::string LookupYamlTag(const MetaData& metadata);
215
216 RTCTK_LOCAL static std::tuple<std::string, std::string, bool>
217 LookupYamlTags(const MetaData& metadata);
218
219 using TagToTypeMap = std::unordered_map<std::string, const std::type_info&>;
220 using TypeToTagMap = std::unordered_map<std::type_index, std::pair<std::string, std::string>>;
221
223 static const TagToTypeMap S_TAG_TO_TYPE;
224
226 static const TypeToTagMap S_TYPE_TO_TAG;
227
228 template <typename T>
230
231 static const RequestDispatcher<PersistentRepoAdapter> S_REQUEST_DISPATCHER;
232};
233
234} // namespace rtctk::componentFramework
235
236#endif // RTCTK_COMPONENTFRAMEWORK_PERSISTENTREPOADAPTER_HPP
This class provides a wrapper for a data point path.
Definition dataPointPath.hpp:74
Used to calculate URIs from datapoint paths.
Definition pathMapper.hpp:33
Exception indicating that validation checks of a CII configuration document failed.
Definition persistentRepoAdapter.hpp:72
Exception indicating a datapoint path does not exist.
Definition persistentRepoAdapter.hpp:83
Exception indicating a general CII configuration service error.
Definition persistentRepoAdapter.hpp:64
Implements the Persistent Configuration Repository adapter that uses the CII configuration service as...
Definition persistentRepoAdapter.hpp:55
PersistentRepoAdapter()=delete
Do not allow construction with no arguments.
PersistentRepoAdapter & operator=(PersistentRepoAdapter &&)=default
Objects of this class can be moved with the move assignment operator.
PersistentRepoAdapter & operator=(const PersistentRepoAdapter &)=delete
This class cannot be copy assigned.
PersistentRepoAdapter(const PersistentRepoAdapter &)=delete
This class cannot be copy constructed.
elt::mal::Uri GetBaseUri() const
Get the base URI used when creating this adapter object.
Definition persistentRepoAdapter.hpp:122
uint64_t GetFitsWriteThreshold() const
Return the number of elements above which matrices and vectors are written to FITS files.
Definition persistentRepoAdapter.hpp:133
PersistentRepoAdapter(PersistentRepoAdapter &&)=default
Objects of this class can be moved.
void SetFitsWriteThreshold(uint64_t value)
Set the number of elements above which matrices and vectors are written to FITS files.
Definition persistentRepoAdapter.hpp:141
Base interface for all Persistent Configuration Repository adapters.
Definition persistentRepoIf.hpp:25
Class for passing/receiving metadata to/from the repository.
Definition repositoryIf.hpp:195
Definition requestDispatcher.hpp:31
The RtctkException class is the base class for all Rtctk exceptions.
Definition exceptions.hpp:211
#define RTCTK_LOCAL
Helper to hide a class or function from the public symbol table.
Definition config.hpp:60
#define RTCTK_API
Helper to indicate that a class or function must be exported in the public symbol table.
Definition config.hpp:33
Provides macros and utilities for exception handling.
Logging Support Library based on log4cplus.
Definition commandReplier.cpp:22
RepositoryIf::PathList PathList
Definition oldbAdapterLegacy.cpp:322
Header file declaring PathMapper.
Header file for PersistentRepoIf, which defines the API for PersistentRepoAdapter.
Header file for the RequestDispatcher utility class.