comparison 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
comparison
equal deleted inserted replaced
4584:b25941dcdbbe 4585:f0bdd99f3d81
53 public: 53 public:
54 typedef std::list<FileInfo> Attachments; 54 typedef std::list<FileInfo> Attachments;
55 typedef std::map<std::pair<ResourceType, MetadataType>, std::string> MetadataMap; 55 typedef std::map<std::pair<ResourceType, MetadataType>, std::string> MetadataMap;
56 56
57 private: 57 private:
58 class TransactionContextFactory;
58 class Listener; 59 class Listener;
59 class Transaction; 60 class Transaction;
60 class UnstableResourcePayload; 61 class UnstableResourcePayload;
61 class MainDicomTagsRegistry; 62 class MainDicomTagsRegistry;
62 63
142 143
143 virtual void SignalChange(const ServerIndexChange& change) = 0; 144 virtual void SignalChange(const ServerIndexChange& change) = 0;
144 }; 145 };
145 146
146 147
148 class ITransactionContextFactory : public boost::noncopyable
149 {
150 public:
151 virtual ~ITransactionContextFactory()
152 {
153 }
154
155 virtual ITransactionContext* Create() = 0;
156 };
157
158
147 class ReadOnlyTransaction : public boost::noncopyable 159 class ReadOnlyTransaction : public boost::noncopyable
148 { 160 {
149 private: 161 private:
150 ITransactionContext& context_; 162 ITransactionContext& context_;
151 163
457 }; 469 };
458 470
459 private: 471 private:
460 void ApplyInternal(IReadOnlyOperations* readOperations, 472 void ApplyInternal(IReadOnlyOperations* readOperations,
461 IReadWriteOperations* writeOperations); 473 IReadWriteOperations* writeOperations);
474
475 std::unique_ptr<ITransactionContextFactory> factory_;
476 unsigned int maxRetries_;
477
478 public:
479 void SetTransactionContextFactory(ITransactionContextFactory* factory /* takes ownership */);
462 480
463 unsigned int maxRetries_;
464
465 public:
466 void Apply(IReadOnlyOperations& operations); 481 void Apply(IReadOnlyOperations& operations);
467 482
468 void Apply(IReadWriteOperations& operations); 483 void Apply(IReadWriteOperations& operations);
469 484
470 bool ExpandResource(Json::Value& target, 485 bool ExpandResource(Json::Value& target,