diff OrthancServer/Sources/ServerContext.cpp @ 4623:95ffe3b6ef7c db-changes

handling of revisions for metadata
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 16 Apr 2021 17:13:03 +0200
parents f75c63aa9de0
children f7d5372b59b3
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerContext.cpp	Fri Apr 16 10:48:57 2021 +0200
+++ b/OrthancServer/Sources/ServerContext.cpp	Fri Apr 16 17:13:03 2021 +0200
@@ -860,7 +860,8 @@
 
       {
         std::string s;
-        if (index_.LookupMetadata(s, instancePublicId, ResourceType_Instance,
+        int64_t revision;  // Ignored
+        if (index_.LookupMetadata(s, revision, instancePublicId, ResourceType_Instance,
                                   MetadataType_Instance_PixelDataOffset))
         {
           hasPixelDataOffset = false;
@@ -971,8 +972,8 @@
           if (DicomStreamReader::LookupPixelDataOffset(pixelDataOffset, dicom) &&
               pixelDataOffset < dicom.size())
           {
-            index_.SetMetadata(instancePublicId, MetadataType_Instance_PixelDataOffset,
-                               boost::lexical_cast<std::string>(pixelDataOffset));
+            index_.OverwriteMetadata(instancePublicId, MetadataType_Instance_PixelDataOffset,
+                                     boost::lexical_cast<std::string>(pixelDataOffset));
 
             if (!area_.HasReadRange() ||
                 compressionEnabled_)
@@ -1018,9 +1019,10 @@
     }
 
     std::string s;
+    int64_t revision;  // Ignored
 
     if (attachment.GetCompressionType() == CompressionType_None &&
-        index_.LookupMetadata(s, instancePublicId, ResourceType_Instance,
+        index_.LookupMetadata(s, revision, instancePublicId, ResourceType_Instance,
                               MetadataType_Instance_PixelDataOffset) &&
         !s.empty())
     {
@@ -1643,7 +1645,8 @@
     if (metadata == MetadataType_Instance_SopClassUid ||
         metadata == MetadataType_Instance_TransferSyntax)
     {
-      if (index_.LookupMetadata(target, publicId, level, metadata))
+      int64_t revision;  // Ignored
+      if (index_.LookupMetadata(target, revision, publicId, level, metadata))
       {
         return true;
       }
@@ -1685,7 +1688,7 @@
           target = value->GetContent();
 
           // Store for reuse
-          index_.SetMetadata(publicId, metadata, target);
+          index_.OverwriteMetadata(publicId, metadata, target);
           return true;
         }
         else
@@ -1698,7 +1701,8 @@
     else
     {
       // No backward
-      return index_.LookupMetadata(target, publicId, level, metadata);
+      int64_t revision;  // Ignored
+      return index_.LookupMetadata(target, revision, publicId, level, metadata);
     }
   }