comparison OrthancServer/Sources/ServerIndex.h @ 4555:456ed3fcff81 db-changes

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 03 Mar 2021 17:13:41 +0100
parents efd90f778cd2
children 2f4d7ec9b993
comparison
equal deleted inserted replaced
4554:efd90f778cd2 4555:456ed3fcff81
160 /* out */ uint64_t& countPatients, 160 /* out */ uint64_t& countPatients,
161 /* out */ uint64_t& countStudies, 161 /* out */ uint64_t& countStudies,
162 /* out */ uint64_t& countSeries, 162 /* out */ uint64_t& countSeries,
163 /* out */ uint64_t& countInstances); 163 /* out */ uint64_t& countInstances);
164 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 */, 165 bool DeleteResource(Json::Value& target /* out */,
178 const std::string& uuid, 166 const std::string& uuid,
179 ResourceType expectedType); 167 ResourceType expectedType);
180 168
181 void GetChanges(Json::Value& target, 169 void GetChanges(Json::Value& target,
299 { 287 {
300 protected: 288 protected:
301 IDatabaseWrapper& db_; 289 IDatabaseWrapper& db_;
302 290
303 public: 291 public:
304 ReadOnlyTransaction(IDatabaseWrapper& db) : 292 explicit ReadOnlyTransaction(IDatabaseWrapper& db) :
305 db_(db) 293 db_(db)
306 { 294 {
307 } 295 }
308 296
309 /** 297 /**
329 317
330 void GetAllMetadata(std::map<MetadataType, std::string>& target, 318 void GetAllMetadata(std::map<MetadataType, std::string>& target,
331 int64_t id) 319 int64_t id)
332 { 320 {
333 db_.GetAllMetadata(target, id); 321 db_.GetAllMetadata(target, id);
334 } 322 }
323
324 void GetAllPublicIds(std::list<std::string>& target,
325 ResourceType resourceType)
326 {
327 return db_.GetAllPublicIds(target, resourceType);
328 }
329
330 void GetAllPublicIds(std::list<std::string>& target,
331 ResourceType resourceType,
332 size_t since,
333 size_t limit)
334 {
335 return db_.GetAllPublicIds(target, resourceType, since, limit);
336 }
335 337
336 void GetChildrenPublicId(std::list<std::string>& target, 338 void GetChildrenPublicId(std::list<std::string>& target,
337 int64_t id) 339 int64_t id)
338 { 340 {
339 db_.GetChildrenPublicId(target, id); 341 db_.GetChildrenPublicId(target, id);
370 372
371 373
372 class ReadWriteTransaction : public ReadOnlyTransaction 374 class ReadWriteTransaction : public ReadOnlyTransaction
373 { 375 {
374 public: 376 public:
375 ReadWriteTransaction(IDatabaseWrapper& db) : 377 explicit ReadWriteTransaction(IDatabaseWrapper& db) :
376 ReadOnlyTransaction(db) 378 ReadOnlyTransaction(db)
377 { 379 {
378 } 380 }
379 381
380 }; 382 };
400 402
401 virtual void Apply(ReadWriteTransaction& transaction) = 0; 403 virtual void Apply(ReadWriteTransaction& transaction) = 0;
402 }; 404 };
403 405
404 406
405 typedef void (*ReadOnlyFunction) (ReadOnlyTransaction& transaction); 407 typedef void (*ReadOnlyFunction) (ReadOnlyTransaction& transaction); // TODO - Is this useful?
406 typedef void (*ReadWriteFunction) (ReadWriteTransaction& transaction); 408 typedef void (*ReadWriteFunction) (ReadWriteTransaction& transaction); // TODO - Is this useful?
407 409
408 410
409 private: 411 private:
410 class ReadOnlyWrapper; 412 class ReadOnlyWrapper; // TODO - Is this useful?
411 class ReadWriteWrapper; 413 class ReadWriteWrapper; // TODO - Is this useful?
412 414
413 void ApplyInternal(IReadOnlyOperations* readOperations, 415 void ApplyInternal(IReadOnlyOperations* readOperations,
414 IReadWriteOperations* writeOperations); 416 IReadWriteOperations* writeOperations);
415 417
416 unsigned int maxRetries_; 418 unsigned int maxRetries_;
429 ResourceType level); 431 ResourceType level);
430 432
431 void GetAllMetadata(std::map<MetadataType, std::string>& target, 433 void GetAllMetadata(std::map<MetadataType, std::string>& target,
432 const std::string& publicId, 434 const std::string& publicId,
433 ResourceType level); 435 ResourceType level);
436
437 void GetAllUuids(std::list<std::string>& target,
438 ResourceType resourceType);
439
440 void GetAllUuids(std::list<std::string>& target,
441 ResourceType resourceType,
442 size_t since,
443 size_t limit);
444
445 bool LookupAttachment(FileInfo& attachment,
446 const std::string& instancePublicId,
447 FileContentType contentType);
434 }; 448 };
435 } 449 }