diff OrthancServer/Sources/ServerIndex.h @ 4585:f0bdd99f3d81 db-changes

created a ITransactionContextFactory around ServerIndex::Listener
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 09 Mar 2021 16:40:38 +0100
parents b25941dcdbbe
children 888868a5dc4e
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerIndex.h	Tue Mar 09 16:18:24 2021 +0100
+++ b/OrthancServer/Sources/ServerIndex.h	Tue Mar 09 16:40:38 2021 +0100
@@ -55,6 +55,7 @@
     typedef std::map<std::pair<ResourceType, MetadataType>, std::string>  MetadataMap;
 
   private:
+    class TransactionContextFactory;
     class Listener;
     class Transaction;
     class UnstableResourcePayload;
@@ -144,6 +145,17 @@
     };
 
     
+    class ITransactionContextFactory : public boost::noncopyable
+    {
+    public:
+      virtual ~ITransactionContextFactory()
+      {
+      }
+
+      virtual ITransactionContext* Create() = 0;
+    };
+
+
     class ReadOnlyTransaction : public boost::noncopyable
     {
     private:
@@ -459,10 +471,13 @@
   private:
     void ApplyInternal(IReadOnlyOperations* readOperations,
                        IReadWriteOperations* writeOperations);
-    
+
+    std::unique_ptr<ITransactionContextFactory>  factory_;
     unsigned int maxRetries_;
 
   public:
+    void SetTransactionContextFactory(ITransactionContextFactory* factory /* takes ownership */);
+    
     void Apply(IReadOnlyOperations& operations);
   
     void Apply(IReadWriteOperations& operations);