# HG changeset patch # User Sebastien Jodogne # Date 1352730547 -3600 # Node ID f68c039b0571b9ed63dc4eed517ac233417a9617 # Parent 5185ae1d9af54cec3beeb4fb4381198f8712ebe8 preparing refactoring of ServerIndex diff -r 5185ae1d9af5 -r f68c039b0571 OrthancServer/ServerIndex.cpp --- a/OrthancServer/ServerIndex.cpp Mon Nov 12 15:11:43 2012 +0100 +++ b/OrthancServer/ServerIndex.cpp Mon Nov 12 15:29:07 2012 +0100 @@ -450,11 +450,34 @@ } + namespace Internals + { + class ServerIndexListenerTmp : public IServerIndexListener + { + public: + virtual void SignalRemainingAncestor(ResourceType parentType, + const std::string& publicId) + { + LOG(INFO) << "Remaning ancestor \"" << publicId << "\" (" << parentType << ")"; + } + + virtual void SignalFileDeleted(const std::string& fileUuid) + { + LOG(INFO) << "Deleted file " << fileUuid; + } + + }; + } + + ServerIndex::ServerIndex(const std::string& storagePath) { + listener2_.reset(new Internals::ServerIndexListenerTmp); + if (storagePath == ":memory:") { db_.OpenInMemory(); + db2_.reset(new DatabaseWrapper(*listener2_)); } else { @@ -468,6 +491,8 @@ { } + db2_.reset(new DatabaseWrapper(p.string() + "/index2", *listener2_)); + p /= "index"; db_.Open(p.string()); } diff -r 5185ae1d9af5 -r f68c039b0571 OrthancServer/ServerIndex.h --- a/OrthancServer/ServerIndex.h Mon Nov 12 15:11:43 2012 +0100 +++ b/OrthancServer/ServerIndex.h Mon Nov 12 15:29:07 2012 +0100 @@ -39,6 +39,8 @@ #include "../Core/DicomFormat/DicomInstanceHasher.h" #include "ServerEnumerations.h" +#include "DatabaseWrapper.h" + namespace Orthanc { @@ -54,6 +56,9 @@ SQLite::Connection db_; boost::mutex mutex_; + std::auto_ptr listener2_; + std::auto_ptr db2_; + // DO NOT delete the following one, SQLite::Connection will do it automatically Internals::SignalDeletedLevelFunction* deletedLevels_;