diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-02-24 21:08:50 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-02-24 21:08:50 +0000 |
commit | 69a534db16bb8dea236882ad1f1817230d64ac26 (patch) | |
tree | b0e0e013bfdb94e843660055c220edd359e68370 | |
parent | Update SQL_REQUIRE_EQUAL to accept literals and include SQL context (diff) | |
download | gentoobrowse-api-69a534db16bb8dea236882ad1f1817230d64ac26.tar.bz2 gentoobrowse-api-69a534db16bb8dea236882ad1f1817230d64ac26.tar.xz gentoobrowse-api-69a534db16bb8dea236882ad1f1817230d64ac26.zip |
Add flag to file processors to indicate if they're being run in vcs mode or not
21 files changed, 73 insertions, 7 deletions
diff --git a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp index ad3fb0b..b0e953e 100644 --- a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp @@ -14,6 +14,11 @@ namespace Gentoo { namespace Service { const int CategoryMetaProcessor::FILETYPEID = 10; + CategoryMetaProcessor::CategoryMetaProcessor(bool vcsMode) : + FileProcessor(vcsMode) + { + } + void CategoryMetaProcessor::created(DB::Connection * dbc, int64_t r, const StringList & fn, const boost::filesystem::path & path) { diff --git a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.h b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.h index 98e5e8f..97dc048 100644 --- a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.h +++ b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.h @@ -12,6 +12,8 @@ namespace Gentoo { public: static const int FILETYPEID; + CategoryMetaProcessor(bool); + void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; void deleted(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn) override; diff --git a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp index 579ca0d..94d83e3 100644 --- a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp @@ -36,7 +36,8 @@ namespace Gentoo { const int EbuildMetaProcessor::FILETYPEID = 1; - EbuildMetaProcessor::EbuildMetaProcessor() : + EbuildMetaProcessor::EbuildMetaProcessor(bool vcsMode) : + FileProcessor(vcsMode), ebuildIds("ebuildId") { } diff --git a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h index 93edf72..7462f91 100644 --- a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h +++ b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h @@ -15,7 +15,7 @@ namespace Gentoo { public: static const int FILETYPEID; - EbuildMetaProcessor(); + EbuildMetaProcessor(bool); void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; diff --git a/gentoobrowse-api/service/maintenance/masksProcessor.cpp b/gentoobrowse-api/service/maintenance/masksProcessor.cpp index e56153e..3d7bc0d 100644 --- a/gentoobrowse-api/service/maintenance/masksProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/masksProcessor.cpp @@ -24,6 +24,11 @@ namespace Gentoo { namespace Service { const int MasksProcessor::FILETYPEID = 3; + MasksProcessor::MasksProcessor(bool vcsMode) : + FileProcessor(vcsMode) + { + } + void MasksProcessor::created(DB::Connection * dbc, int64_t r, const StringList & fn, const boost::filesystem::path & path) { diff --git a/gentoobrowse-api/service/maintenance/masksProcessor.h b/gentoobrowse-api/service/maintenance/masksProcessor.h index b92bd10..591c53a 100644 --- a/gentoobrowse-api/service/maintenance/masksProcessor.h +++ b/gentoobrowse-api/service/maintenance/masksProcessor.h @@ -12,6 +12,8 @@ namespace Gentoo { public: static const int FILETYPEID; + MasksProcessor(bool); + void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; void deleted(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn) override; diff --git a/gentoobrowse-api/service/maintenance/newsProcessor.cpp b/gentoobrowse-api/service/maintenance/newsProcessor.cpp index 07230ba..5e654c9 100644 --- a/gentoobrowse-api/service/maintenance/newsProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/newsProcessor.cpp @@ -11,6 +11,11 @@ namespace Gentoo { namespace Service { const int NewsProcessor::FILETYPEID = 11; + NewsProcessor::NewsProcessor(bool vcsMode) : + FileProcessor(vcsMode) + { + } + void NewsProcessor::created(DB::Connection * dbc, int64_t, const StringList &, const boost::filesystem::path & path) { diff --git a/gentoobrowse-api/service/maintenance/newsProcessor.h b/gentoobrowse-api/service/maintenance/newsProcessor.h index 65c33c4..54d7690 100644 --- a/gentoobrowse-api/service/maintenance/newsProcessor.h +++ b/gentoobrowse-api/service/maintenance/newsProcessor.h @@ -12,6 +12,8 @@ namespace Gentoo { public: static const int FILETYPEID; + NewsProcessor(bool); + void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; void deleted(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn) override; diff --git a/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp index 653db7f..d28274a 100644 --- a/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp @@ -14,6 +14,11 @@ namespace Gentoo { namespace Service { const int PackageMetaProcessor::FILETYPEID = 4; + PackageMetaProcessor::PackageMetaProcessor(bool vcsMode) : + FileProcessor(vcsMode) + { + } + void PackageMetaProcessor::created(DB::Connection * dbc, int64_t r, const StringList & fn, const boost::filesystem::path & path) { diff --git a/gentoobrowse-api/service/maintenance/packageMetaProcessor.h b/gentoobrowse-api/service/maintenance/packageMetaProcessor.h index 55da84c..450013e 100644 --- a/gentoobrowse-api/service/maintenance/packageMetaProcessor.h +++ b/gentoobrowse-api/service/maintenance/packageMetaProcessor.h @@ -11,6 +11,8 @@ namespace Gentoo { public: static const int FILETYPEID; + PackageMetaProcessor(bool); + void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; void deleted(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn) override; diff --git a/gentoobrowse-api/service/maintenance/updatesProcessor.cpp b/gentoobrowse-api/service/maintenance/updatesProcessor.cpp index 78d8897..8fbddd6 100644 --- a/gentoobrowse-api/service/maintenance/updatesProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/updatesProcessor.cpp @@ -22,6 +22,11 @@ namespace Gentoo { namespace Service { const int UpdatesProcessor::FILETYPEID = 12; + UpdatesProcessor::UpdatesProcessor(bool vcsMode) : + FileProcessor(vcsMode) + { + } + class UpdatesPatch : public DB::TablePatch, public DB::SqlWriter { public: UpdatesPatch(DB::Connection * db) : diff --git a/gentoobrowse-api/service/maintenance/updatesProcessor.h b/gentoobrowse-api/service/maintenance/updatesProcessor.h index 4b6891b..f955a1f 100644 --- a/gentoobrowse-api/service/maintenance/updatesProcessor.h +++ b/gentoobrowse-api/service/maintenance/updatesProcessor.h @@ -13,6 +13,8 @@ namespace Gentoo { public: static const int FILETYPEID; + UpdatesProcessor(bool); + void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; void deleted(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn) override; diff --git a/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp b/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp index 243d11b..0659ae6 100644 --- a/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp @@ -13,6 +13,11 @@ namespace Gentoo { namespace Service { const int UseGlobalProcessor::FILETYPEID = 5; + UseGlobalProcessor::UseGlobalProcessor(bool vcsMode) : + FileProcessor(vcsMode) + { + } + void UseGlobalProcessor::created(DB::Connection * dbc, int64_t r, const StringList & fn, const boost::filesystem::path & path) { diff --git a/gentoobrowse-api/service/maintenance/useGlobalProcessor.h b/gentoobrowse-api/service/maintenance/useGlobalProcessor.h index 73d3c8a..9dc3b1f 100644 --- a/gentoobrowse-api/service/maintenance/useGlobalProcessor.h +++ b/gentoobrowse-api/service/maintenance/useGlobalProcessor.h @@ -12,6 +12,8 @@ namespace Gentoo { public: static const int FILETYPEID; + UseGlobalProcessor(bool); + void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; void deleted(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn) override; diff --git a/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp b/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp index b21a701..ac26086 100644 --- a/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp @@ -18,6 +18,11 @@ namespace Gentoo { namespace Service { const int UseGroupProcessor::FILETYPEID = 9; + UseGroupProcessor::UseGroupProcessor(bool vcsMode) : + FileProcessor(vcsMode) + { + } + void UseGroupProcessor::created(DB::Connection * dbc, int64_t, const StringList &, const boost::filesystem::path & path) { diff --git a/gentoobrowse-api/service/maintenance/useGroupProcessor.h b/gentoobrowse-api/service/maintenance/useGroupProcessor.h index 9cc34c5..abe4f38 100644 --- a/gentoobrowse-api/service/maintenance/useGroupProcessor.h +++ b/gentoobrowse-api/service/maintenance/useGroupProcessor.h @@ -12,6 +12,8 @@ namespace Gentoo { public: static const int FILETYPEID; + UseGroupProcessor(bool); + void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; void deleted(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn) override; diff --git a/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp b/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp index 2b82616..015af99 100644 --- a/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp @@ -15,6 +15,11 @@ namespace Gentoo { namespace Service { const int UseLocalProcessor::FILETYPEID = 6; + UseLocalProcessor::UseLocalProcessor(bool vcsMode) : + FileProcessor(vcsMode) + { + } + void UseLocalProcessor::created(DB::Connection * dbc, int64_t r, const StringList & fn, const boost::filesystem::path & path) { diff --git a/gentoobrowse-api/service/maintenance/useLocalProcessor.h b/gentoobrowse-api/service/maintenance/useLocalProcessor.h index b743b15..ea80dc9 100644 --- a/gentoobrowse-api/service/maintenance/useLocalProcessor.h +++ b/gentoobrowse-api/service/maintenance/useLocalProcessor.h @@ -12,6 +12,8 @@ namespace Gentoo { public: static const int FILETYPEID; + UseLocalProcessor(bool); + void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; void deleted(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn) override; diff --git a/gentoobrowse-api/service/maintenanceCommon.cpp b/gentoobrowse-api/service/maintenanceCommon.cpp index 8a55087..d7fdc1b 100644 --- a/gentoobrowse-api/service/maintenanceCommon.cpp +++ b/gentoobrowse-api/service/maintenanceCommon.cpp @@ -9,6 +9,11 @@ namespace Gentoo { namespace Service { + Maintenance::FileProcessor::FileProcessor(bool v) : + vcsMode(v) + { + } + Ice::PropertiesPtr Maintenance::properties(const Ice::Current & c) { diff --git a/gentoobrowse-api/service/maintenancePackageTree.cpp b/gentoobrowse-api/service/maintenancePackageTree.cpp index 2bcb860..531dc47 100644 --- a/gentoobrowse-api/service/maintenancePackageTree.cpp +++ b/gentoobrowse-api/service/maintenancePackageTree.cpp @@ -61,9 +61,9 @@ R"DATA( 10 category metadata 2 2 {"(2,metadata.xml)"} template<typename T> Maintenance::FileProcessorPtr - Maintenance::createFileProessor() + Maintenance::createFileProessor(bool vcsMode) { - return FileProcessorPtr(new T()); + return FileProcessorPtr(new T(vcsMode)); } Maintenance::Maintenance(IceTray::DatabasePoolPtr d) : @@ -193,7 +193,7 @@ R"DATA( 10 category metadata 2 2 {"(2,metadata.xml)"} { FileProcessors fps; for (const auto & fpf : fpfs) { - fps[fpf.first] = fpf.second(); + fps[fpf.first] = fpf.second(false); } for (const auto & fp : fps) { fp.second->prepare(dbc); diff --git a/gentoobrowse-api/service/maintenanceimpl.h b/gentoobrowse-api/service/maintenanceimpl.h index dc6cbbf..57ea94a 100644 --- a/gentoobrowse-api/service/maintenanceimpl.h +++ b/gentoobrowse-api/service/maintenanceimpl.h @@ -15,6 +15,7 @@ namespace Gentoo { public: class DLL_PRIVATE FileProcessor { public: + FileProcessor(bool vcsMode); virtual ~FileProcessor() = 0; virtual void prepare(DB::Connection *); @@ -24,10 +25,13 @@ namespace Gentoo { virtual void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) = 0; virtual void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) = 0; virtual void deleted(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn) = 0; + + protected: + const bool vcsMode; }; typedef boost::shared_ptr<FileProcessor> FileProcessorPtr; - typedef std::map<int64_t, boost::function<FileProcessorPtr()>> FileProcessorFactories; + typedef std::map<int64_t, boost::function<FileProcessorPtr(bool)>> FileProcessorFactories; typedef std::map<int64_t, FileProcessorPtr> FileProcessors; typedef boost::function<void(FileProcessorPtr, int64_t, const Gentoo::StringList &, const boost::filesystem::path &)> FileHandleFunc; typedef std::map<int64_t, std::string> RepoMap; @@ -53,7 +57,7 @@ namespace Gentoo { static Ice::PropertiesPtr properties(const Ice::Current &); template <typename T> - static FileProcessorPtr createFileProessor(); + static FileProcessorPtr createFileProessor(bool vcsMode); FileProcessorFactories fpfs; }; } |