diff OrthancServer/Sources/ServerIndex.cpp @ 4589:bec74e29f86b db-changes

attaching the listener to transactions in IDatabaseWrapper
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 12 Mar 2021 15:33:47 +0100
parents 94147ce2f097
children 4a0bf1019335
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerIndex.cpp	Wed Mar 10 17:15:01 2021 +0100
+++ b/OrthancServer/Sources/ServerIndex.cpp	Fri Mar 12 15:33:47 2021 +0100
@@ -51,8 +51,7 @@
 
 namespace Orthanc
 {
-  class ServerIndex::Listener : public IDatabaseListener,
-                                public ServerIndex::ITransactionContext
+  class ServerIndex::Listener : public StatelessDatabaseOperations::ITransactionContext
   {
   private:
     struct FileToRemove
@@ -333,6 +332,23 @@
       {
         return listener_.GetCompressedSizeDelta();
       }
+
+      virtual void SignalRemainingAncestor(ResourceType parentType,
+                                           const std::string& publicId) ORTHANC_OVERRIDE
+      {
+        listener_.SignalRemainingAncestor(parentType, publicId);
+      }
+
+      virtual void SignalAttachmentDeleted(const FileInfo& info) ORTHANC_OVERRIDE
+      {
+        listener_.SignalAttachmentDeleted(info);
+      }
+
+      virtual void SignalResourceDeleted(ResourceType type,
+                                         const std::string& publicId) ORTHANC_OVERRIDE
+      {
+        listener_.SignalResourceDeleted(type, publicId);
+      }
     };
 
     ServerIndex& index_;
@@ -437,7 +453,6 @@
     maximumPatients_(0)
   {
     listener_.reset(new Listener(context));
-    db.SetListener(*listener_);
 
     SetTransactionContextFactory(new TransactionContextFactory(*this));