diff OrthancServer/Sources/Database/StatelessDatabaseOperations.h @ 4627:f7d5372b59b3 db-changes

handling revisions of attachments
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 20 Apr 2021 15:11:59 +0200
parents 95ffe3b6ef7c
children 66109d24d26e
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.h	Mon Apr 19 10:28:43 2021 +0200
+++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.h	Tue Apr 20 15:11:59 2021 +0200
@@ -240,10 +240,11 @@
       }
 
       bool LookupAttachment(FileInfo& attachment,
+                            int64_t& revision,
                             int64_t id,
                             FileContentType contentType)
       {
-        return transaction_.LookupAttachment(attachment, id, contentType);
+        return transaction_.LookupAttachment(attachment, revision, id, contentType);
       }
       
       bool LookupGlobalProperty(std::string& target,
@@ -294,9 +295,10 @@
       }
 
       void AddAttachment(int64_t id,
-                         const FileInfo& attachment)
+                         const FileInfo& attachment,
+                         int64_t revision)
       {
-        transaction_.AddAttachment(id, attachment);
+        transaction_.AddAttachment(id, attachment, revision);
       }
       
       void ClearChanges()
@@ -481,6 +483,7 @@
                              /* out */ uint64_t& countInstances);
 
     bool LookupAttachment(FileInfo& attachment,
+                          int64_t& revision,
                           const std::string& instancePublicId,
                           FileContentType contentType);
 
@@ -600,8 +603,10 @@
                            bool shared,
                            const std::string& value);
 
-    void DeleteAttachment(const std::string& publicId,
-                          FileContentType type);
+    bool DeleteAttachment(const std::string& publicId,
+                          FileContentType type,
+                          bool hasRevision,
+                          int64_t revision);
 
     void LogChange(int64_t internalId,
                    ChangeType changeType,
@@ -623,9 +628,12 @@
                       uint64_t maximumStorageSize,
                       unsigned int maximumPatients);
 
-    StoreStatus AddAttachment(const FileInfo& attachment,
+    StoreStatus AddAttachment(int64_t& newRevision /*out*/,
+                              const FileInfo& attachment,
                               const std::string& publicId,
                               uint64_t maximumStorageSize,
-                              unsigned int maximumPatients);
+                              unsigned int maximumPatients,
+                              bool hasOldRevision,
+                              int64_t oldRevision);
   };
 }