summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-03-06 01:33:14 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2017-03-06 01:33:14 +0000
commitb0fe8bd0ba5c5d232b0c7c6d2c8119a0d146dc70 (patch)
treeed3ca014c4424a4da6a7b4ee50072247c808d1f2
parentSplit setting up file processors from common constructor (diff)
downloadgentoobrowse-api-b0fe8bd0ba5c5d232b0c7c6d2c8119a0d146dc70.tar.bz2
gentoobrowse-api-b0fe8bd0ba5c5d232b0c7c6d2c8119a0d146dc70.tar.xz
gentoobrowse-api-b0fe8bd0ba5c5d232b0c7c6d2c8119a0d146dc70.zip
Split the abstract file processor out of maintenance common
-rw-r--r--gentoobrowse-api/service/maintenance/abstractFileProcessor.cpp31
-rw-r--r--gentoobrowse-api/service/maintenance/abstractFileProcessor.h31
-rw-r--r--gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp2
-rw-r--r--gentoobrowse-api/service/maintenance/categoryMetaProcessor.h6
-rw-r--r--gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp3
-rw-r--r--gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h4
-rw-r--r--gentoobrowse-api/service/maintenance/masksProcessor.cpp2
-rw-r--r--gentoobrowse-api/service/maintenance/masksProcessor.h4
-rw-r--r--gentoobrowse-api/service/maintenance/newsProcessor.cpp2
-rw-r--r--gentoobrowse-api/service/maintenance/newsProcessor.h4
-rw-r--r--gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp2
-rw-r--r--gentoobrowse-api/service/maintenance/packageMetaProcessor.h4
-rw-r--r--gentoobrowse-api/service/maintenance/updatesProcessor.cpp3
-rw-r--r--gentoobrowse-api/service/maintenance/updatesProcessor.h4
-rw-r--r--gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp2
-rw-r--r--gentoobrowse-api/service/maintenance/useGlobalProcessor.h4
-rw-r--r--gentoobrowse-api/service/maintenance/useGroupProcessor.cpp2
-rw-r--r--gentoobrowse-api/service/maintenance/useGroupProcessor.h4
-rw-r--r--gentoobrowse-api/service/maintenance/useLocalProcessor.cpp2
-rw-r--r--gentoobrowse-api/service/maintenance/useLocalProcessor.h4
-rw-r--r--gentoobrowse-api/service/maintenanceCommon.cpp5
-rw-r--r--gentoobrowse-api/service/maintenanceGitOperations.cpp6
-rw-r--r--gentoobrowse-api/service/maintenancePackageTree.cpp27
-rw-r--r--gentoobrowse-api/service/maintenanceimpl.h21
24 files changed, 100 insertions, 79 deletions
diff --git a/gentoobrowse-api/service/maintenance/abstractFileProcessor.cpp b/gentoobrowse-api/service/maintenance/abstractFileProcessor.cpp
new file mode 100644
index 0000000..170839b
--- /dev/null
+++ b/gentoobrowse-api/service/maintenance/abstractFileProcessor.cpp
@@ -0,0 +1,31 @@
+#include "abstractFileProcessor.h"
+
+namespace Gentoo {
+ namespace Service {
+ AbstractFileProcessor::AbstractFileProcessor(bool v) :
+ vcsMode(v)
+ {
+ }
+
+ AbstractFileProcessor::~AbstractFileProcessor()
+ {
+ }
+
+ void
+ AbstractFileProcessor::prepare(DB::Connection *)
+ {
+ }
+
+ void
+ AbstractFileProcessor::apply(DB::Connection *)
+ {
+ }
+
+ void
+ AbstractFileProcessor::tidy(DB::Connection *)
+ {
+ }
+
+ }
+}
+
diff --git a/gentoobrowse-api/service/maintenance/abstractFileProcessor.h b/gentoobrowse-api/service/maintenance/abstractFileProcessor.h
new file mode 100644
index 0000000..3780cdd
--- /dev/null
+++ b/gentoobrowse-api/service/maintenance/abstractFileProcessor.h
@@ -0,0 +1,31 @@
+#ifndef GENTOOBROWSE_API_SERVICE_MAINTENANCE_ABSTRACTPROC_H
+#define GENTOOBROWSE_API_SERVICE_MAINTENANCE_ABSTRACTPROC_H
+
+#include <connection.h>
+#include <maintenance.h>
+#include <boost/filesystem/path.hpp>
+
+namespace Gentoo {
+ namespace Service {
+ class AbstractFileProcessor {
+ public:
+ AbstractFileProcessor(bool vcsMode);
+ virtual ~AbstractFileProcessor() = 0;
+
+ virtual void prepare(DB::Connection *);
+ virtual void apply(DB::Connection *);
+ virtual void tidy(DB::Connection *);
+
+ 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<AbstractFileProcessor> FileProcessorPtr;
+ }
+}
+
+#endif
+
diff --git a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp
index b0e953e..68eee65 100644
--- a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp
+++ b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp
@@ -15,7 +15,7 @@ namespace Gentoo {
const int CategoryMetaProcessor::FILETYPEID = 10;
CategoryMetaProcessor::CategoryMetaProcessor(bool vcsMode) :
- FileProcessor(vcsMode)
+ AbstractFileProcessor(vcsMode)
{
}
diff --git a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.h b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.h
index 97dc048..948d56b 100644
--- a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.h
+++ b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.h
@@ -1,14 +1,12 @@
#ifndef GENTOOBROWSE_API_SERVICE_MAINTENANCE_CATEGORYMETAPROC_H
#define GENTOOBROWSE_API_SERVICE_MAINTENANCE_CATEGORYMETAPROC_H
-#include "../maintenanceimpl.h"
+#include "abstractFileProcessor.h"
#include <connection.h>
-#include <modifycommand.h>
-#include <boost/filesystem/path.hpp>
namespace Gentoo {
namespace Service {
- class CategoryMetaProcessor : public Maintenance::FileProcessor {
+ class CategoryMetaProcessor : public AbstractFileProcessor {
public:
static const int FILETYPEID;
diff --git a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp
index 94d83e3..f36c73c 100644
--- a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp
+++ b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp
@@ -5,6 +5,7 @@
#include <sqlWriter.h>
#include <boost/filesystem/operations.hpp>
#include <boost/algorithm/string/join.hpp>
+#include <boost/date_time/posix_time/conversion.hpp>
#include <glibmm/regex.h>
#include <tablepatch.h>
#include <optionalUtils.h>
@@ -37,7 +38,7 @@ namespace Gentoo {
const int EbuildMetaProcessor::FILETYPEID = 1;
EbuildMetaProcessor::EbuildMetaProcessor(bool vcsMode) :
- FileProcessor(vcsMode),
+ AbstractFileProcessor(vcsMode),
ebuildIds("ebuildId")
{
}
diff --git a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h
index 7462f91..ef3bbae 100644
--- a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h
+++ b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h
@@ -1,7 +1,7 @@
#ifndef GENTOOBROWSE_API_SERVICE_MAINTENANCE_EBUILDMETAPROC_H
#define GENTOOBROWSE_API_SERVICE_MAINTENANCE_EBUILDMETAPROC_H
-#include "../maintenanceimpl.h"
+#include "abstractFileProcessor.h"
#include "utils/ebuildCacheParser.h"
#include <portage-models.h>
#include <connection.h>
@@ -11,7 +11,7 @@
namespace Gentoo {
namespace Service {
- class EbuildMetaProcessor : public Maintenance::FileProcessor {
+ class EbuildMetaProcessor : public AbstractFileProcessor {
public:
static const int FILETYPEID;
diff --git a/gentoobrowse-api/service/maintenance/masksProcessor.cpp b/gentoobrowse-api/service/maintenance/masksProcessor.cpp
index 3d7bc0d..402184e 100644
--- a/gentoobrowse-api/service/maintenance/masksProcessor.cpp
+++ b/gentoobrowse-api/service/maintenance/masksProcessor.cpp
@@ -25,7 +25,7 @@ namespace Gentoo {
const int MasksProcessor::FILETYPEID = 3;
MasksProcessor::MasksProcessor(bool vcsMode) :
- FileProcessor(vcsMode)
+ AbstractFileProcessor(vcsMode)
{
}
diff --git a/gentoobrowse-api/service/maintenance/masksProcessor.h b/gentoobrowse-api/service/maintenance/masksProcessor.h
index 591c53a..a569736 100644
--- a/gentoobrowse-api/service/maintenance/masksProcessor.h
+++ b/gentoobrowse-api/service/maintenance/masksProcessor.h
@@ -1,14 +1,14 @@
#ifndef GENTOOBROWSE_API_SERVICE_MAINTENANCE_MASKSPROC_H
#define GENTOOBROWSE_API_SERVICE_MAINTENANCE_MASKSPROC_H
-#include "../maintenanceimpl.h"
+#include "abstractFileProcessor.h"
#include <connection.h>
#include <modifycommand.h>
#include <boost/filesystem/path.hpp>
namespace Gentoo {
namespace Service {
- class MasksProcessor : public Maintenance::FileProcessor {
+ class MasksProcessor : public AbstractFileProcessor {
public:
static const int FILETYPEID;
diff --git a/gentoobrowse-api/service/maintenance/newsProcessor.cpp b/gentoobrowse-api/service/maintenance/newsProcessor.cpp
index 5e654c9..32b05f7 100644
--- a/gentoobrowse-api/service/maintenance/newsProcessor.cpp
+++ b/gentoobrowse-api/service/maintenance/newsProcessor.cpp
@@ -12,7 +12,7 @@ namespace Gentoo {
const int NewsProcessor::FILETYPEID = 11;
NewsProcessor::NewsProcessor(bool vcsMode) :
- FileProcessor(vcsMode)
+ AbstractFileProcessor(vcsMode)
{
}
diff --git a/gentoobrowse-api/service/maintenance/newsProcessor.h b/gentoobrowse-api/service/maintenance/newsProcessor.h
index 54d7690..5da1019 100644
--- a/gentoobrowse-api/service/maintenance/newsProcessor.h
+++ b/gentoobrowse-api/service/maintenance/newsProcessor.h
@@ -1,14 +1,14 @@
#ifndef GENTOOBROWSE_API_SERVICE_MAINTENANCE_NEWSPROC_H
#define GENTOOBROWSE_API_SERVICE_MAINTENANCE_NEWSPROC_H
-#include "../maintenanceimpl.h"
+#include "abstractFileProcessor.h"
#include <connection.h>
#include <boost/filesystem/path.hpp>
#include <portage-models.h>
namespace Gentoo {
namespace Service {
- class NewsProcessor : public Maintenance::FileProcessor {
+ class NewsProcessor : public AbstractFileProcessor {
public:
static const int FILETYPEID;
diff --git a/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp
index d28274a..f5e0ba2 100644
--- a/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp
+++ b/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp
@@ -15,7 +15,7 @@ namespace Gentoo {
const int PackageMetaProcessor::FILETYPEID = 4;
PackageMetaProcessor::PackageMetaProcessor(bool vcsMode) :
- FileProcessor(vcsMode)
+ AbstractFileProcessor(vcsMode)
{
}
diff --git a/gentoobrowse-api/service/maintenance/packageMetaProcessor.h b/gentoobrowse-api/service/maintenance/packageMetaProcessor.h
index 450013e..af9455f 100644
--- a/gentoobrowse-api/service/maintenance/packageMetaProcessor.h
+++ b/gentoobrowse-api/service/maintenance/packageMetaProcessor.h
@@ -1,13 +1,13 @@
#ifndef GENTOOBROWSE_API_SERVICE_MAINTENANCE_PACKAGEMETAPROC_H
#define GENTOOBROWSE_API_SERVICE_MAINTENANCE_PACKAGEMETAPROC_H
-#include "../maintenanceimpl.h"
+#include "abstractFileProcessor.h"
#include <connection.h>
#include <boost/filesystem/path.hpp>
namespace Gentoo {
namespace Service {
- class PackageMetaProcessor : public Maintenance::FileProcessor {
+ class PackageMetaProcessor : public AbstractFileProcessor {
public:
static const int FILETYPEID;
diff --git a/gentoobrowse-api/service/maintenance/updatesProcessor.cpp b/gentoobrowse-api/service/maintenance/updatesProcessor.cpp
index 852829a..25cebe0 100644
--- a/gentoobrowse-api/service/maintenance/updatesProcessor.cpp
+++ b/gentoobrowse-api/service/maintenance/updatesProcessor.cpp
@@ -7,6 +7,7 @@
#include "utils/entityWhereFilter.h"
#include <glibmm/regex.h>
#include <fstream>
+#include <boost/bind.hpp>
#include <sql/maintenance/updatesPackageDirFiles.sql.h>
#include <sql/maintenance/updatesMD5CacheFiles.sql.h>
#include <sql/maintenance/updatesMovePackages.sql.h>
@@ -25,7 +26,7 @@ namespace Gentoo {
const int UpdatesProcessor::FILETYPEID = 12;
UpdatesProcessor::UpdatesProcessor(bool vcsMode) :
- FileProcessor(vcsMode)
+ AbstractFileProcessor(vcsMode)
{
}
diff --git a/gentoobrowse-api/service/maintenance/updatesProcessor.h b/gentoobrowse-api/service/maintenance/updatesProcessor.h
index f955a1f..48c37a9 100644
--- a/gentoobrowse-api/service/maintenance/updatesProcessor.h
+++ b/gentoobrowse-api/service/maintenance/updatesProcessor.h
@@ -1,7 +1,7 @@
#ifndef GENTOOBROWSE_API_SERVICE_MAINTENANCE_UPDATESPROC_H
#define GENTOOBROWSE_API_SERVICE_MAINTENANCE_UPDATESPROC_H
-#include "../maintenanceimpl.h"
+#include "abstractFileProcessor.h"
#include <connection.h>
#include <modifycommand.h>
#include <boost/filesystem/path.hpp>
@@ -9,7 +9,7 @@
namespace Gentoo {
namespace Service {
class UpdatesPatch;
- class UpdatesProcessor : public Maintenance::FileProcessor {
+ class UpdatesProcessor : public AbstractFileProcessor {
public:
static const int FILETYPEID;
diff --git a/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp b/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp
index 0659ae6..5a89167 100644
--- a/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp
+++ b/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp
@@ -14,7 +14,7 @@ namespace Gentoo {
const int UseGlobalProcessor::FILETYPEID = 5;
UseGlobalProcessor::UseGlobalProcessor(bool vcsMode) :
- FileProcessor(vcsMode)
+ AbstractFileProcessor(vcsMode)
{
}
diff --git a/gentoobrowse-api/service/maintenance/useGlobalProcessor.h b/gentoobrowse-api/service/maintenance/useGlobalProcessor.h
index 9dc3b1f..1254bd2 100644
--- a/gentoobrowse-api/service/maintenance/useGlobalProcessor.h
+++ b/gentoobrowse-api/service/maintenance/useGlobalProcessor.h
@@ -1,14 +1,14 @@
#ifndef GENTOOBROWSE_API_SERVICE_MAINTENANCE_USEGLOBALPROC_H
#define GENTOOBROWSE_API_SERVICE_MAINTENANCE_USEGLOBALPROC_H
-#include "../maintenanceimpl.h"
+#include "abstractFileProcessor.h"
#include <connection.h>
#include <modifycommand.h>
#include <boost/filesystem/path.hpp>
namespace Gentoo {
namespace Service {
- class UseGlobalProcessor : public Maintenance::FileProcessor {
+ class UseGlobalProcessor : public AbstractFileProcessor {
public:
static const int FILETYPEID;
diff --git a/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp b/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp
index ac26086..39d5498 100644
--- a/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp
+++ b/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp
@@ -19,7 +19,7 @@ namespace Gentoo {
const int UseGroupProcessor::FILETYPEID = 9;
UseGroupProcessor::UseGroupProcessor(bool vcsMode) :
- FileProcessor(vcsMode)
+ AbstractFileProcessor(vcsMode)
{
}
diff --git a/gentoobrowse-api/service/maintenance/useGroupProcessor.h b/gentoobrowse-api/service/maintenance/useGroupProcessor.h
index abe4f38..cfe514c 100644
--- a/gentoobrowse-api/service/maintenance/useGroupProcessor.h
+++ b/gentoobrowse-api/service/maintenance/useGroupProcessor.h
@@ -1,14 +1,14 @@
#ifndef GENTOOBROWSE_API_SERVICE_MAINTENANCE_USEGROUPPROC_H
#define GENTOOBROWSE_API_SERVICE_MAINTENANCE_USEGROUPPROC_H
-#include "../maintenanceimpl.h"
+#include "abstractFileProcessor.h"
#include <connection.h>
#include <modifycommand.h>
#include <boost/filesystem/path.hpp>
namespace Gentoo {
namespace Service {
- class UseGroupProcessor : public Maintenance::FileProcessor {
+ class UseGroupProcessor : public AbstractFileProcessor {
public:
static const int FILETYPEID;
diff --git a/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp b/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp
index 015af99..0c65b0c 100644
--- a/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp
+++ b/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp
@@ -16,7 +16,7 @@ namespace Gentoo {
const int UseLocalProcessor::FILETYPEID = 6;
UseLocalProcessor::UseLocalProcessor(bool vcsMode) :
- FileProcessor(vcsMode)
+ AbstractFileProcessor(vcsMode)
{
}
diff --git a/gentoobrowse-api/service/maintenance/useLocalProcessor.h b/gentoobrowse-api/service/maintenance/useLocalProcessor.h
index ea80dc9..c1b1470 100644
--- a/gentoobrowse-api/service/maintenance/useLocalProcessor.h
+++ b/gentoobrowse-api/service/maintenance/useLocalProcessor.h
@@ -1,14 +1,14 @@
#ifndef GENTOOBROWSE_API_SERVICE_MAINTENANCE_USELOCALPROC_H
#define GENTOOBROWSE_API_SERVICE_MAINTENANCE_USELOCALPROC_H
-#include "../maintenanceimpl.h"
+#include "abstractFileProcessor.h"
#include <connection.h>
#include <modifycommand.h>
#include <boost/filesystem/path.hpp>
namespace Gentoo {
namespace Service {
- class UseLocalProcessor : public Maintenance::FileProcessor {
+ class UseLocalProcessor : public AbstractFileProcessor {
public:
static const int FILETYPEID;
diff --git a/gentoobrowse-api/service/maintenanceCommon.cpp b/gentoobrowse-api/service/maintenanceCommon.cpp
index 77a9dea..c2c96a3 100644
--- a/gentoobrowse-api/service/maintenanceCommon.cpp
+++ b/gentoobrowse-api/service/maintenanceCommon.cpp
@@ -19,11 +19,6 @@ namespace Gentoo {
{
}
- Maintenance::FileProcessor::FileProcessor(bool v) :
- vcsMode(v)
- {
- }
-
Ice::PropertiesPtr
Maintenance::properties(const Ice::Current & c)
{
diff --git a/gentoobrowse-api/service/maintenanceGitOperations.cpp b/gentoobrowse-api/service/maintenanceGitOperations.cpp
index e306741..27ee672 100644
--- a/gentoobrowse-api/service/maintenanceGitOperations.cpp
+++ b/gentoobrowse-api/service/maintenanceGitOperations.cpp
@@ -209,9 +209,9 @@ namespace Gentoo {
repos[id] = path;
});
std::map<std::string, FileHandleFunc> funcs;
- funcs["D"] = boost::bind(&FileProcessor::deleted, _1, dbc.get(), _2, _3);
- funcs["M"] = boost::bind(&FileProcessor::modified, _1, dbc.get(), _2, _3, _4);
- funcs["A"] = boost::bind(&FileProcessor::created, _1, dbc.get(), _2, _3, _4);
+ funcs["D"] = boost::bind(&AbstractFileProcessor::deleted, _1, dbc.get(), _2, _3);
+ funcs["M"] = boost::bind(&AbstractFileProcessor::modified, _1, dbc.get(), _2, _3, _4);
+ funcs["A"] = boost::bind(&AbstractFileProcessor::created, _1, dbc.get(), _2, _3, _4);
auto phases = sql::maintenance::filelistPhases.select(dbc.get());
for (const auto & phaseRow : phases->as<int64_t>()) {
const auto & phase = phaseRow.value<0>();
diff --git a/gentoobrowse-api/service/maintenancePackageTree.cpp b/gentoobrowse-api/service/maintenancePackageTree.cpp
index 50580d5..ef008d6 100644
--- a/gentoobrowse-api/service/maintenancePackageTree.cpp
+++ b/gentoobrowse-api/service/maintenancePackageTree.cpp
@@ -40,27 +40,8 @@ R"DATA( 10 category metadata 2 2 {"(2,metadata.xml)"}
// 7 licenses {"(1,licenses)"}
namespace Service {
- Maintenance::FileProcessor::~FileProcessor()
- {
- }
-
- void
- Maintenance::FileProcessor::prepare(DB::Connection *)
- {
- }
-
- void
- Maintenance::FileProcessor::apply(DB::Connection *)
- {
- }
-
- void
- Maintenance::FileProcessor::tidy(DB::Connection *)
- {
- }
-
template<typename T>
- Maintenance::FileProcessorPtr
+ FileProcessorPtr
Maintenance::createFileProessor(bool vcsMode)
{
return FileProcessorPtr(new T(vcsMode));
@@ -83,7 +64,7 @@ R"DATA( 10 category metadata 2 2 {"(2,metadata.xml)"}
void
Maintenance::fileDeleted(DB::Connection * dbc, const FileProcessors * fps, const boost::filesystem::path & tmp, const RepoMap * repos, DB::SelectCommandPtr s)
{
- auto f = boost::bind(&FileProcessor::deleted, _1, dbc, _2, _3);
+ auto f = boost::bind(&AbstractFileProcessor::deleted, _1, dbc, _2, _3);
// filesize, filetypeid, moddate, pathparts, repoid
s->forEachRow<int64_t, int64_t, boost::posix_time::ptime, std::string, int64_t>([&f,repos,dbc,&tmp,this,fps](auto, auto ft, auto, auto pp, auto repoid) {
this->fileHandle(ft, fps, repos, repoid, pp, tmp, f);
@@ -93,7 +74,7 @@ R"DATA( 10 category metadata 2 2 {"(2,metadata.xml)"}
void
Maintenance::fileChanged(DB::Connection * dbc, const FileProcessors * fps, const boost::filesystem::path & tmp, const RepoMap * repos, DB::SelectCommandPtr s)
{
- auto f = boost::bind(&FileProcessor::modified, _1, dbc, _2, _3, _4);
+ auto f = boost::bind(&AbstractFileProcessor::modified, _1, dbc, _2, _3, _4);
// pathparts, repoid, old_filesize, old_filetypeid, old_moddate, new_filesize, new_filetypeid, new_moddate
s->forEachRow<std::string, int64_t, int64_t, int64_t, boost::posix_time::ptime, int64_t, int64_t, boost::posix_time::ptime>([&f,repos,dbc,&tmp,this,fps](auto pp, auto repoid, auto, auto ft, auto, auto, auto, auto) {
this->fileHandle(ft, fps, repos, repoid, pp, tmp, f);
@@ -103,7 +84,7 @@ R"DATA( 10 category metadata 2 2 {"(2,metadata.xml)"}
void
Maintenance::fileCreated(DB::Connection * dbc, const FileProcessors * fps, const boost::filesystem::path & tmp, const RepoMap * repos, DB::SelectCommandPtr s)
{
- auto f = boost::bind(&FileProcessor::created, _1, dbc, _2, _3, _4);
+ auto f = boost::bind(&AbstractFileProcessor::created, _1, dbc, _2, _3, _4);
// filesize, filetypeid, moddate, pathparts, repoid
s->forEachRow<int64_t, int64_t, boost::posix_time::ptime, std::string, int64_t>([&f,repos,dbc,&tmp,this,fps](auto, auto ft, auto, auto pp, auto repoid) {
this->fileHandle(ft, fps, repos, repoid, pp, tmp, f);
diff --git a/gentoobrowse-api/service/maintenanceimpl.h b/gentoobrowse-api/service/maintenanceimpl.h
index b9974f1..b6b480a 100644
--- a/gentoobrowse-api/service/maintenanceimpl.h
+++ b/gentoobrowse-api/service/maintenanceimpl.h
@@ -6,31 +6,14 @@
#include <visibility.h>
#include <abstractDatabaseClient.h>
#include <map>
-#include <boost/function.hpp>
+#include <boost/function/function_fwd.hpp>
#include <converters.h>
+#include "maintenance/abstractFileProcessor.h"
namespace Gentoo {
namespace Service {
class DLL_PUBLIC Maintenance : public Gentoo::Maintenance, IceTray::AbstractDatabaseClient {
public:
- class DLL_PRIVATE FileProcessor {
- public:
- FileProcessor(bool vcsMode);
- virtual ~FileProcessor() = 0;
-
- virtual void prepare(DB::Connection *);
- virtual void apply(DB::Connection *);
- virtual void tidy(DB::Connection *);
-
- 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(bool)>> FileProcessorFactories;
typedef std::map<int64_t, FileProcessorPtr> FileProcessors;
typedef boost::function<void(FileProcessorPtr, int64_t, const Gentoo::StringList &, const boost::filesystem::path &)> FileHandleFunc;