comparison OrthancServer/ServerIndex.h @ 3174:8ea7c4546c3a

primitives to collect metrics in Orthanc
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 29 Jan 2019 15:15:48 +0100
parents beeeb6096f27
children 4bbadcd03966
comparison
equal deleted inserted replaced
3173:096f4a29f223 3174:8ea7c4546c3a
95 95
96 void MarkAsUnstable(int64_t id, 96 void MarkAsUnstable(int64_t id,
97 Orthanc::ResourceType type, 97 Orthanc::ResourceType type,
98 const std::string& publicId); 98 const std::string& publicId);
99 99
100 void GetStatisticsInternal(/* out */ uint64_t& diskSize, 100 bool GetMetadataAsInteger(int64_t& result,
101 int64_t id,
102 MetadataType type);
103
104 void LogChange(int64_t internalId,
105 ChangeType changeType,
106 ResourceType resourceType,
107 const std::string& publicId);
108
109 void SignalNewResource(ChangeType changeType,
110 ResourceType level,
111 const std::string& publicId,
112 int64_t internalId);
113
114 uint64_t IncrementGlobalSequenceInternal(GlobalProperty property);
115
116 void NormalizeLookup(std::vector<DatabaseConstraint>& target,
117 const DatabaseLookup& source,
118 ResourceType level) const;
119
120 SeriesStatus GetSeriesStatus(int64_t id,
121 int64_t expectedNumberOfInstances);
122
123 public:
124 ServerIndex(ServerContext& context,
125 IDatabaseWrapper& database,
126 unsigned int threadSleep);
127
128 ~ServerIndex();
129
130 void Stop();
131
132 uint64_t GetMaximumStorageSize() const
133 {
134 return maximumStorageSize_;
135 }
136
137 uint64_t GetMaximumPatientCount() const
138 {
139 return maximumPatients_;
140 }
141
142 // "size == 0" means no limit on the storage size
143 void SetMaximumStorageSize(uint64_t size);
144
145 // "count == 0" means no limit on the number of patients
146 void SetMaximumPatientCount(unsigned int count);
147
148 void SetOverwriteInstances(bool overwrite);
149
150 StoreStatus Store(std::map<MetadataType, std::string>& instanceMetadata,
151 DicomInstanceToStore& instance,
152 const Attachments& attachments);
153
154 void GetGlobalStatistics(/* out */ uint64_t& diskSize,
155 /* out */ uint64_t& uncompressedSize,
156 /* out */ uint64_t& countPatients,
157 /* out */ uint64_t& countStudies,
158 /* out */ uint64_t& countSeries,
159 /* out */ uint64_t& countInstances);
160
161 bool LookupResource(Json::Value& result,
162 const std::string& publicId,
163 ResourceType expectedType);
164
165 bool LookupAttachment(FileInfo& attachment,
166 const std::string& instanceUuid,
167 FileContentType contentType);
168
169 void GetAllUuids(std::list<std::string>& target,
170 ResourceType resourceType);
171
172 void GetAllUuids(std::list<std::string>& target,
173 ResourceType resourceType,
174 size_t since,
175 size_t limit);
176
177 bool DeleteResource(Json::Value& target /* out */,
178 const std::string& uuid,
179 ResourceType expectedType);
180
181 void GetChanges(Json::Value& target,
182 int64_t since,
183 unsigned int maxResults);
184
185 void GetLastChange(Json::Value& target);
186
187 void LogExportedResource(const std::string& publicId,
188 const std::string& remoteModality);
189
190 void GetExportedResources(Json::Value& target,
191 int64_t since,
192 unsigned int maxResults);
193
194 void GetLastExportedResource(Json::Value& target);
195
196 bool IsProtectedPatient(const std::string& publicId);
197
198 void SetProtectedPatient(const std::string& publicId,
199 bool isProtected);
200
201 void GetChildren(std::list<std::string>& result,
202 const std::string& publicId);
203
204 void GetChildInstances(std::list<std::string>& result,
205 const std::string& publicId);
206
207 void SetMetadata(const std::string& publicId,
208 MetadataType type,
209 const std::string& value);
210
211 void DeleteMetadata(const std::string& publicId,
212 MetadataType type);
213
214 bool LookupMetadata(std::string& target,
215 const std::string& publicId,
216 MetadataType type);
217
218 void ListAvailableMetadata(std::list<MetadataType>& target,
219 const std::string& publicId);
220
221 bool GetMetadata(Json::Value& target,
222 const std::string& publicId);
223
224 void ListAvailableAttachments(std::list<FileContentType>& target,
225 const std::string& publicId,
226 ResourceType expectedType);
227
228 bool LookupParent(std::string& target,
229 const std::string& publicId);
230
231 uint64_t IncrementGlobalSequence(GlobalProperty sequence);
232
233 void LogChange(ChangeType changeType,
234 const std::string& publicId);
235
236 void DeleteChanges();
237
238 void DeleteExportedResources();
239
240 void GetResourceStatistics(/* out */ ResourceType& type,
241 /* out */ uint64_t& diskSize,
101 /* out */ uint64_t& uncompressedSize, 242 /* out */ uint64_t& uncompressedSize,
102 /* out */ unsigned int& countStudies, 243 /* out */ unsigned int& countStudies,
103 /* out */ unsigned int& countSeries, 244 /* out */ unsigned int& countSeries,
104 /* out */ unsigned int& countInstances, 245 /* out */ unsigned int& countInstances,
105 /* out */ uint64_t& dicomDiskSize, 246 /* out */ uint64_t& dicomDiskSize,
106 /* out */ uint64_t& dicomUncompressedSize, 247 /* out */ uint64_t& dicomUncompressedSize,
107 /* in */ int64_t id,
108 /* in */ ResourceType type);
109
110 bool GetMetadataAsInteger(int64_t& result,
111 int64_t id,
112 MetadataType type);
113
114 void LogChange(int64_t internalId,
115 ChangeType changeType,
116 ResourceType resourceType,
117 const std::string& publicId);
118
119 void SignalNewResource(ChangeType changeType,
120 ResourceType level,
121 const std::string& publicId,
122 int64_t internalId);
123
124 uint64_t IncrementGlobalSequenceInternal(GlobalProperty property);
125
126 void NormalizeLookup(std::vector<DatabaseConstraint>& target,
127 const DatabaseLookup& source,
128 ResourceType level) const;
129
130 SeriesStatus GetSeriesStatus(int64_t id,
131 int64_t expectedNumberOfInstances);
132
133 public:
134 ServerIndex(ServerContext& context,
135 IDatabaseWrapper& database,
136 unsigned int threadSleep);
137
138 ~ServerIndex();
139
140 void Stop();
141
142 uint64_t GetMaximumStorageSize() const
143 {
144 return maximumStorageSize_;
145 }
146
147 uint64_t GetMaximumPatientCount() const
148 {
149 return maximumPatients_;
150 }
151
152 // "size == 0" means no limit on the storage size
153 void SetMaximumStorageSize(uint64_t size);
154
155 // "count == 0" means no limit on the number of patients
156 void SetMaximumPatientCount(unsigned int count);
157
158 void SetOverwriteInstances(bool overwrite);
159
160 StoreStatus Store(std::map<MetadataType, std::string>& instanceMetadata,
161 DicomInstanceToStore& instance,
162 const Attachments& attachments);
163
164 void ComputeStatistics(Json::Value& target);
165
166 bool LookupResource(Json::Value& result,
167 const std::string& publicId,
168 ResourceType expectedType);
169
170 bool LookupAttachment(FileInfo& attachment,
171 const std::string& instanceUuid,
172 FileContentType contentType);
173
174 void GetAllUuids(std::list<std::string>& target,
175 ResourceType resourceType);
176
177 void GetAllUuids(std::list<std::string>& target,
178 ResourceType resourceType,
179 size_t since,
180 size_t limit);
181
182 bool DeleteResource(Json::Value& target /* out */,
183 const std::string& uuid,
184 ResourceType expectedType);
185
186 void GetChanges(Json::Value& target,
187 int64_t since,
188 unsigned int maxResults);
189
190 void GetLastChange(Json::Value& target);
191
192 void LogExportedResource(const std::string& publicId,
193 const std::string& remoteModality);
194
195 void GetExportedResources(Json::Value& target,
196 int64_t since,
197 unsigned int maxResults);
198
199 void GetLastExportedResource(Json::Value& target);
200
201 bool IsProtectedPatient(const std::string& publicId);
202
203 void SetProtectedPatient(const std::string& publicId,
204 bool isProtected);
205
206 void GetChildren(std::list<std::string>& result,
207 const std::string& publicId);
208
209 void GetChildInstances(std::list<std::string>& result,
210 const std::string& publicId);
211
212 void SetMetadata(const std::string& publicId,
213 MetadataType type,
214 const std::string& value);
215
216 void DeleteMetadata(const std::string& publicId,
217 MetadataType type);
218
219 bool LookupMetadata(std::string& target,
220 const std::string& publicId,
221 MetadataType type);
222
223 void ListAvailableMetadata(std::list<MetadataType>& target,
224 const std::string& publicId); 248 const std::string& publicId);
225
226 bool GetMetadata(Json::Value& target,
227 const std::string& publicId);
228
229 void ListAvailableAttachments(std::list<FileContentType>& target,
230 const std::string& publicId,
231 ResourceType expectedType);
232
233 bool LookupParent(std::string& target,
234 const std::string& publicId);
235
236 uint64_t IncrementGlobalSequence(GlobalProperty sequence);
237
238 void LogChange(ChangeType changeType,
239 const std::string& publicId);
240
241 void DeleteChanges();
242
243 void DeleteExportedResources();
244
245 void GetStatistics(Json::Value& target,
246 const std::string& publicId);
247
248 void GetStatistics(/* out */ uint64_t& diskSize,
249 /* out */ uint64_t& uncompressedSize,
250 /* out */ unsigned int& countStudies,
251 /* out */ unsigned int& countSeries,
252 /* out */ unsigned int& countInstances,
253 /* out */ uint64_t& dicomDiskSize,
254 /* out */ uint64_t& dicomUncompressedSize,
255 const std::string& publicId);
256 249
257 void LookupIdentifierExact(std::vector<std::string>& result, 250 void LookupIdentifierExact(std::vector<std::string>& result,
258 ResourceType level, 251 ResourceType level,
259 const DicomTag& tag, 252 const DicomTag& tag,
260 const std::string& value); 253 const std::string& value);