comparison 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
comparison
equal deleted inserted replaced
4588:94147ce2f097 4589:bec74e29f86b
49 49
50 static const uint64_t MEGA_BYTES = 1024 * 1024; 50 static const uint64_t MEGA_BYTES = 1024 * 1024;
51 51
52 namespace Orthanc 52 namespace Orthanc
53 { 53 {
54 class ServerIndex::Listener : public IDatabaseListener, 54 class ServerIndex::Listener : public StatelessDatabaseOperations::ITransactionContext
55 public ServerIndex::ITransactionContext
56 { 55 {
57 private: 56 private:
58 struct FileToRemove 57 struct FileToRemove
59 { 58 {
60 private: 59 private:
331 330
332 virtual int64_t GetCompressedSizeDelta() ORTHANC_OVERRIDE 331 virtual int64_t GetCompressedSizeDelta() ORTHANC_OVERRIDE
333 { 332 {
334 return listener_.GetCompressedSizeDelta(); 333 return listener_.GetCompressedSizeDelta();
335 } 334 }
335
336 virtual void SignalRemainingAncestor(ResourceType parentType,
337 const std::string& publicId) ORTHANC_OVERRIDE
338 {
339 listener_.SignalRemainingAncestor(parentType, publicId);
340 }
341
342 virtual void SignalAttachmentDeleted(const FileInfo& info) ORTHANC_OVERRIDE
343 {
344 listener_.SignalAttachmentDeleted(info);
345 }
346
347 virtual void SignalResourceDeleted(ResourceType type,
348 const std::string& publicId) ORTHANC_OVERRIDE
349 {
350 listener_.SignalResourceDeleted(type, publicId);
351 }
336 }; 352 };
337 353
338 ServerIndex& index_; 354 ServerIndex& index_;
339 355
340 public: 356 public:
435 done_(false), 451 done_(false),
436 maximumStorageSize_(0), 452 maximumStorageSize_(0),
437 maximumPatients_(0) 453 maximumPatients_(0)
438 { 454 {
439 listener_.reset(new Listener(context)); 455 listener_.reset(new Listener(context));
440 db.SetListener(*listener_);
441 456
442 SetTransactionContextFactory(new TransactionContextFactory(*this)); 457 SetTransactionContextFactory(new TransactionContextFactory(*this));
443 458
444 // Initial recycling if the parameters have changed since the last 459 // Initial recycling if the parameters have changed since the last
445 // execution of Orthanc 460 // execution of Orthanc