Mercurial > hg > orthanc
changeset 186:f68c039b0571
preparing refactoring of ServerIndex
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 12 Nov 2012 15:29:07 +0100 |
parents | 5185ae1d9af5 |
children | 8e673a65564d |
files | OrthancServer/ServerIndex.cpp OrthancServer/ServerIndex.h |
diffstat | 2 files changed, 30 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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()); }
--- 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<IServerIndexListener> listener2_; + std::auto_ptr<DatabaseWrapper> db2_; + // DO NOT delete the following one, SQLite::Connection will do it automatically Internals::SignalDeletedLevelFunction* deletedLevels_;