comparison OrthancServer/Sources/ServerIndex.h @ 4567:b812a5f2cef3 db-changes

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 08 Mar 2021 14:41:29 +0100
parents 3495a3d97ab6
children a3e6aa2b07b0
comparison
equal deleted inserted replaced
4566:f52d0bc19e07 4567:b812a5f2cef3
104 void SignalNewResource(ChangeType changeType, 104 void SignalNewResource(ChangeType changeType,
105 ResourceType level, 105 ResourceType level,
106 const std::string& publicId, 106 const std::string& publicId,
107 int64_t internalId); 107 int64_t internalId);
108 108
109 uint64_t IncrementGlobalSequenceInternal(GlobalProperty property);
110
111 void NormalizeLookup(std::vector<DatabaseConstraint>& target, 109 void NormalizeLookup(std::vector<DatabaseConstraint>& target,
112 const DatabaseLookup& source, 110 const DatabaseLookup& source,
113 ResourceType level) const; 111 ResourceType level) const;
114 112
115 // A transaction must be running 113 // A transaction must be running
153 bool hasTransferSyntax, 151 bool hasTransferSyntax,
154 DicomTransferSyntax transferSyntax, 152 DicomTransferSyntax transferSyntax,
155 bool hasPixelDataOffset, 153 bool hasPixelDataOffset,
156 uint64_t pixelDataOffset); 154 uint64_t pixelDataOffset);
157 155
158 void SetProtectedPatient(const std::string& publicId,
159 bool isProtected);
160
161 void SetMetadata(const std::string& publicId,
162 MetadataType type,
163 const std::string& value);
164
165 void DeleteMetadata(const std::string& publicId,
166 MetadataType type);
167
168 uint64_t IncrementGlobalSequence(GlobalProperty sequence);
169
170 void LogChange(ChangeType changeType, 156 void LogChange(ChangeType changeType,
171 const std::string& publicId); 157 const std::string& publicId);
172 158
173 void DeleteChanges();
174
175 void DeleteExportedResources();
176
177 StoreStatus AddAttachment(const FileInfo& attachment, 159 StoreStatus AddAttachment(const FileInfo& attachment,
178 const std::string& publicId); 160 const std::string& publicId);
179 161
180 void DeleteAttachment(const std::string& publicId, 162 void DeleteAttachment(const std::string& publicId,
181 FileContentType type); 163 FileContentType type);
182
183 void SetGlobalProperty(GlobalProperty property,
184 const std::string& value);
185 164
186 void ReconstructInstance(const ParsedDicomFile& dicom); 165 void ReconstructInstance(const ParsedDicomFile& dicom);
187 166
188 167
189 168
386 }; 365 };
387 366
388 367
389 class ReadWriteTransaction : public ReadOnlyTransaction 368 class ReadWriteTransaction : public ReadOnlyTransaction
390 { 369 {
370 private:
371 ServerIndex& index_;
372
391 public: 373 public:
392 explicit ReadWriteTransaction(IDatabaseWrapper& db) : 374 ReadWriteTransaction(IDatabaseWrapper& db,
393 ReadOnlyTransaction(db) 375 ServerIndex& index) :
394 { 376 ReadOnlyTransaction(db),
377 index_(index) // TODO - REMOVE
378 {
379 }
380
381 void ClearChanges()
382 {
383 db_.ClearChanges();
384 }
385
386 void ClearExportedResources()
387 {
388 db_.ClearExportedResources();
389 }
390
391 void DeleteMetadata(int64_t id,
392 MetadataType type)
393 {
394 db_.DeleteMetadata(id, type);
395 } 395 }
396 396
397 void DeleteResource(int64_t id) 397 void DeleteResource(int64_t id)
398 { 398 {
399 db_.DeleteResource(id); 399 db_.DeleteResource(id);
400 } 400 }
401 401
402 void LogChange(int64_t internalId,
403 ChangeType changeType,
404 ResourceType resourceType,
405 const std::string& publicId)
406 {
407 index_.LogChange(internalId, changeType, resourceType, publicId);
408 }
409
402 void LogExportedResource(const ExportedResource& resource) 410 void LogExportedResource(const ExportedResource& resource)
403 { 411 {
404 db_.LogExportedResource(resource); 412 db_.LogExportedResource(resource);
413 }
414
415 void SetGlobalProperty(GlobalProperty property,
416 const std::string& value)
417 {
418 db_.SetGlobalProperty(property, value);
419 }
420
421 void SetMetadata(int64_t id,
422 MetadataType type,
423 const std::string& value)
424 {
425 return db_.SetMetadata(id, type, value);
426 }
427
428 void SetProtectedPatient(int64_t internalId,
429 bool isProtected)
430 {
431 db_.SetProtectedPatient(internalId, isProtected);
405 } 432 }
406 }; 433 };
407 434
408 435
409 class IReadOnlyOperations : public boost::noncopyable 436 class IReadOnlyOperations : public boost::noncopyable
547 const std::string& uuid, 574 const std::string& uuid,
548 ResourceType expectedType); 575 ResourceType expectedType);
549 576
550 void LogExportedResource(const std::string& publicId, 577 void LogExportedResource(const std::string& publicId,
551 const std::string& remoteModality); 578 const std::string& remoteModality);
579
580 void SetProtectedPatient(const std::string& publicId,
581 bool isProtected);
582
583 void SetMetadata(const std::string& publicId,
584 MetadataType type,
585 const std::string& value);
586
587 void DeleteMetadata(const std::string& publicId,
588 MetadataType type);
589
590 uint64_t IncrementGlobalSequence(GlobalProperty sequence);
591
592 void DeleteChanges();
593
594 void DeleteExportedResources();
595
596 void SetGlobalProperty(GlobalProperty property,
597 const std::string& value);
552 }; 598 };
553 } 599 }