comparison OrthancServer/ServerIndex.cpp @ 186:f68c039b0571

preparing refactoring of ServerIndex
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 12 Nov 2012 15:29:07 +0100
parents 626777d01dc4
children 8e673a65564d
comparison
equal deleted inserted replaced
185:5185ae1d9af5 186:f68c039b0571
448 448
449 return true; 449 return true;
450 } 450 }
451 451
452 452
453 namespace Internals
454 {
455 class ServerIndexListenerTmp : public IServerIndexListener
456 {
457 public:
458 virtual void SignalRemainingAncestor(ResourceType parentType,
459 const std::string& publicId)
460 {
461 LOG(INFO) << "Remaning ancestor \"" << publicId << "\" (" << parentType << ")";
462 }
463
464 virtual void SignalFileDeleted(const std::string& fileUuid)
465 {
466 LOG(INFO) << "Deleted file " << fileUuid;
467 }
468
469 };
470 }
471
472
453 ServerIndex::ServerIndex(const std::string& storagePath) 473 ServerIndex::ServerIndex(const std::string& storagePath)
454 { 474 {
475 listener2_.reset(new Internals::ServerIndexListenerTmp);
476
455 if (storagePath == ":memory:") 477 if (storagePath == ":memory:")
456 { 478 {
457 db_.OpenInMemory(); 479 db_.OpenInMemory();
480 db2_.reset(new DatabaseWrapper(*listener2_));
458 } 481 }
459 else 482 else
460 { 483 {
461 boost::filesystem::path p = storagePath; 484 boost::filesystem::path p = storagePath;
462 485
465 boost::filesystem::create_directories(storagePath); 488 boost::filesystem::create_directories(storagePath);
466 } 489 }
467 catch (boost::filesystem::filesystem_error) 490 catch (boost::filesystem::filesystem_error)
468 { 491 {
469 } 492 }
493
494 db2_.reset(new DatabaseWrapper(p.string() + "/index2", *listener2_));
470 495
471 p /= "index"; 496 p /= "index";
472 db_.Open(p.string()); 497 db_.Open(p.string());
473 } 498 }
474 499