summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-05-23 09:11:05 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2016-05-23 09:11:05 +0100
commitf4388b6a0b60eaefa1cf4848a2f4551e9c239d0d (patch)
tree1393f1401f5d1d6f7372be11c9540fadfd42af16
parentCreate file processors per run maintenance run (diff)
downloadgentoobrowse-api-f4388b6a0b60eaefa1cf4848a2f4551e9c239d0d.tar.bz2
gentoobrowse-api-f4388b6a0b60eaefa1cf4848a2f4551e9c239d0d.tar.xz
gentoobrowse-api-f4388b6a0b60eaefa1cf4848a2f4551e9c239d0d.zip
Non-const processor methods and prepare, apply and tidy events
-rw-r--r--gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp6
-rw-r--r--gentoobrowse-api/service/maintenance/categoryMetaProcessor.h6
-rw-r--r--gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp10
-rw-r--r--gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h10
-rw-r--r--gentoobrowse-api/service/maintenance/masksProcessor.cpp6
-rw-r--r--gentoobrowse-api/service/maintenance/masksProcessor.h6
-rw-r--r--gentoobrowse-api/service/maintenance/packageManifestProcessor.cpp4
-rw-r--r--gentoobrowse-api/service/maintenance/packageManifestProcessor.h4
-rw-r--r--gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp6
-rw-r--r--gentoobrowse-api/service/maintenance/packageMetaProcessor.h6
-rw-r--r--gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp6
-rw-r--r--gentoobrowse-api/service/maintenance/useGlobalProcessor.h6
-rw-r--r--gentoobrowse-api/service/maintenance/useGroupProcessor.cpp8
-rw-r--r--gentoobrowse-api/service/maintenance/useGroupProcessor.h8
-rw-r--r--gentoobrowse-api/service/maintenance/useLocalProcessor.cpp6
-rw-r--r--gentoobrowse-api/service/maintenance/useLocalProcessor.h6
-rw-r--r--gentoobrowse-api/service/maintenanceimpl.cpp30
-rw-r--r--gentoobrowse-api/service/maintenanceimpl.h12
18 files changed, 87 insertions, 59 deletions
diff --git a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp
index bf7c35c..235faa2 100644
--- a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp
+++ b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp
@@ -13,13 +13,13 @@ namespace Gentoo {
const int CategoryMetaProcessor::FILETYPEID = 10;
void
- CategoryMetaProcessor::created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const
+ CategoryMetaProcessor::created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path)
{
modified(dbc, fn, path);
}
void
- CategoryMetaProcessor::modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const
+ CategoryMetaProcessor::modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path)
{
DB::ModifyCommandPtr m = dbc->modify(sql::maintenance::categoryMetaUpdate.getSql());
U::XmlDoc md(path);
@@ -32,7 +32,7 @@ namespace Gentoo {
}
void
- CategoryMetaProcessor::deleted(DB::Connection * dbc, const boost::filesystem::path & fn) const
+ CategoryMetaProcessor::deleted(DB::Connection * dbc, const boost::filesystem::path & fn)
{
auto m = dbc->modify(sql::maintenance::categoryMetaUpdate.getSql());
m->bindNull(0);
diff --git a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.h b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.h
index e335cd8..96224c6 100644
--- a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.h
+++ b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.h
@@ -12,9 +12,9 @@ namespace Gentoo {
public:
static const int FILETYPEID;
- void created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const;
- void modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const;
- void deleted(DB::Connection * dbc, const boost::filesystem::path & fn) const;
+ void created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) override;
+ void modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) override;
+ void deleted(DB::Connection * dbc, const boost::filesystem::path & fn) override;
};
}
}
diff --git a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp
index ef849fb..230a00f 100644
--- a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp
+++ b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp
@@ -34,7 +34,7 @@ namespace Gentoo {
const int EbuildMetaProcessor::FILETYPEID = 1;
void
- EbuildMetaProcessor::created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const
+ EbuildMetaProcessor::created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path)
{
Glib::MatchInfo matches;
const Glib::ustring pv = (fn / 4).string();
@@ -75,7 +75,7 @@ namespace Gentoo {
}
void
- EbuildMetaProcessor::modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const
+ EbuildMetaProcessor::modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path)
{
Glib::MatchInfo matches;
const Glib::ustring pv = (fn / 4).string();
@@ -97,7 +97,7 @@ namespace Gentoo {
}
void
- EbuildMetaProcessor::perEbuildUpdates(DB::Connection * dbc, const U::EbuildCacheParser & ecp, int64_t ebuildId, bool newest, int64_t packageId) const
+ EbuildMetaProcessor::perEbuildUpdates(DB::Connection * dbc, const U::EbuildCacheParser & ecp, int64_t ebuildId, bool newest, int64_t packageId)
{
U::EntityWhereFilter ewf("ebuildId", ebuildId);
// IUSE
@@ -168,7 +168,7 @@ namespace Gentoo {
}
void
- EbuildMetaProcessor::insertDeps(DB::ModifyCommand * ins, const std::vector<Gentoo::DependencyPtr> & deps) const
+ EbuildMetaProcessor::insertDeps(DB::ModifyCommand * ins, const std::vector<Gentoo::DependencyPtr> & deps)
{
for (const auto & d : deps) {
ins->bindParamS(0, d->category);
@@ -182,7 +182,7 @@ namespace Gentoo {
}
void
- EbuildMetaProcessor::deleted(DB::Connection * dbc, const boost::filesystem::path & fn) const
+ EbuildMetaProcessor::deleted(DB::Connection * dbc, const boost::filesystem::path & fn)
{
Glib::MatchInfo matches;
const Glib::ustring pv = (fn / 4).string();
diff --git a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h
index fb9d48c..51daad0 100644
--- a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h
+++ b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h
@@ -14,13 +14,13 @@ namespace Gentoo {
public:
static const int FILETYPEID;
- void created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const;
- void modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const;
- void deleted(DB::Connection * dbc, const boost::filesystem::path & fn) const;
+ void created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) override;
+ void modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) override;
+ void deleted(DB::Connection * dbc, const boost::filesystem::path & fn) override;
private:
- void perEbuildUpdates(DB::Connection * dbc, const Utils::EbuildCacheParser & ecp, int64_t ebuildId, bool newest, int64_t packageId) const;
- void insertDeps(DB::ModifyCommand * dbc, const std::vector<Gentoo::DependencyPtr> &) const;
+ void perEbuildUpdates(DB::Connection * dbc, const Utils::EbuildCacheParser & ecp, int64_t ebuildId, bool newest, int64_t packageId);
+ void insertDeps(DB::ModifyCommand * dbc, const std::vector<Gentoo::DependencyPtr> &);
};
}
}
diff --git a/gentoobrowse-api/service/maintenance/masksProcessor.cpp b/gentoobrowse-api/service/maintenance/masksProcessor.cpp
index 58f56de..225ccb8 100644
--- a/gentoobrowse-api/service/maintenance/masksProcessor.cpp
+++ b/gentoobrowse-api/service/maintenance/masksProcessor.cpp
@@ -23,13 +23,13 @@ namespace Gentoo {
const int MasksProcessor::FILETYPEID = 3;
void
- MasksProcessor::created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const
+ MasksProcessor::created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path)
{
modified(dbc, fn, path);
}
void
- MasksProcessor::modified(DB::Connection * dbc, const boost::filesystem::path &, const boost::filesystem::path & path) const
+ MasksProcessor::modified(DB::Connection * dbc, const boost::filesystem::path &, const boost::filesystem::path & path)
{
auto tempTable = Utils::Database::namedTemp(dbc, "tmp_masks", {
{ "n", "int" },
@@ -101,7 +101,7 @@ namespace Gentoo {
}
void
- MasksProcessor::deleted(DB::Connection * dbc, const boost::filesystem::path &) const
+ MasksProcessor::deleted(DB::Connection * dbc, const boost::filesystem::path &)
{
dbc->modify("DELETE FROM gentoobrowse.use_local")->execute();
}
diff --git a/gentoobrowse-api/service/maintenance/masksProcessor.h b/gentoobrowse-api/service/maintenance/masksProcessor.h
index eb147e4..2fc2b39 100644
--- a/gentoobrowse-api/service/maintenance/masksProcessor.h
+++ b/gentoobrowse-api/service/maintenance/masksProcessor.h
@@ -12,9 +12,9 @@ namespace Gentoo {
public:
static const int FILETYPEID;
- void created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const;
- void modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const;
- void deleted(DB::Connection * dbc, const boost::filesystem::path & fn) const;
+ void created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) override;
+ void modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) override;
+ void deleted(DB::Connection * dbc, const boost::filesystem::path & fn) override;
};
}
}
diff --git a/gentoobrowse-api/service/maintenance/packageManifestProcessor.cpp b/gentoobrowse-api/service/maintenance/packageManifestProcessor.cpp
index e22ce3b..f4e67b3 100644
--- a/gentoobrowse-api/service/maintenance/packageManifestProcessor.cpp
+++ b/gentoobrowse-api/service/maintenance/packageManifestProcessor.cpp
@@ -9,14 +9,14 @@ namespace Gentoo {
const int PackageManifestProcessor::FILETYPEID = 8;
void
- PackageManifestProcessor::created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path &) const
+ PackageManifestProcessor::created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path &)
{
(void)dbc;
(void)fn;
}
void
- PackageManifestProcessor::deleted(DB::Connection * dbc, const boost::filesystem::path & fn) const
+ PackageManifestProcessor::deleted(DB::Connection * dbc, const boost::filesystem::path & fn)
{
(void)dbc;
(void)fn;
diff --git a/gentoobrowse-api/service/maintenance/packageManifestProcessor.h b/gentoobrowse-api/service/maintenance/packageManifestProcessor.h
index f7347b2..e68257e 100644
--- a/gentoobrowse-api/service/maintenance/packageManifestProcessor.h
+++ b/gentoobrowse-api/service/maintenance/packageManifestProcessor.h
@@ -12,8 +12,8 @@ namespace Gentoo {
public:
static const int FILETYPEID;
- void created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const;
- void deleted(DB::Connection * dbc, const boost::filesystem::path & fn) const;
+ void created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) override;
+ void deleted(DB::Connection * dbc, const boost::filesystem::path & fn) override;
};
}
}
diff --git a/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp
index 55aa1ee..5be86ec 100644
--- a/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp
+++ b/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp
@@ -13,13 +13,13 @@ namespace Gentoo {
const int PackageMetaProcessor::FILETYPEID = 4;
void
- PackageMetaProcessor::created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const
+ PackageMetaProcessor::created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path)
{
modified(dbc, fn, path);
}
void
- PackageMetaProcessor::modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const
+ PackageMetaProcessor::modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path)
{
auto m = dbc->modify(sql::maintenance::packageMetaUpdate.getSql());
U::XmlDoc md(path);
@@ -36,7 +36,7 @@ namespace Gentoo {
}
void
- PackageMetaProcessor::deleted(DB::Connection * dbc, const boost::filesystem::path & fn) const
+ PackageMetaProcessor::deleted(DB::Connection * dbc, const boost::filesystem::path & fn)
{
auto m = dbc->modify(sql::maintenance::packageMetaUpdate.getSql());
m->bindNull(0);
diff --git a/gentoobrowse-api/service/maintenance/packageMetaProcessor.h b/gentoobrowse-api/service/maintenance/packageMetaProcessor.h
index 44bb77e..c620828 100644
--- a/gentoobrowse-api/service/maintenance/packageMetaProcessor.h
+++ b/gentoobrowse-api/service/maintenance/packageMetaProcessor.h
@@ -11,9 +11,9 @@ namespace Gentoo {
public:
static const int FILETYPEID;
- void created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const;
- void modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const;
- void deleted(DB::Connection * dbc, const boost::filesystem::path & fn) const;
+ void created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) override;
+ void modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) override;
+ void deleted(DB::Connection * dbc, const boost::filesystem::path & fn) override;
};
}
}
diff --git a/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp b/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp
index a860112..457383f 100644
--- a/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp
+++ b/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp
@@ -14,13 +14,13 @@ namespace Gentoo {
const int UseGlobalProcessor::FILETYPEID = 5;
void
- UseGlobalProcessor::created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const
+ UseGlobalProcessor::created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path)
{
modified(dbc, fn, path);
}
void
- UseGlobalProcessor::modified(DB::Connection * dbc, const boost::filesystem::path &, const boost::filesystem::path & path) const
+ UseGlobalProcessor::modified(DB::Connection * dbc, const boost::filesystem::path &, const boost::filesystem::path & path)
{
DB::TablePatch p;
p.dest = "gentoobrowse.use_global";
@@ -43,7 +43,7 @@ namespace Gentoo {
}
void
- UseGlobalProcessor::deleted(DB::Connection * dbc, const boost::filesystem::path &) const
+ UseGlobalProcessor::deleted(DB::Connection * dbc, const boost::filesystem::path &)
{
dbc->modify("DELETE FROM gentoobrowse.use_global")->execute();
}
diff --git a/gentoobrowse-api/service/maintenance/useGlobalProcessor.h b/gentoobrowse-api/service/maintenance/useGlobalProcessor.h
index c5e3dcb..c74af91 100644
--- a/gentoobrowse-api/service/maintenance/useGlobalProcessor.h
+++ b/gentoobrowse-api/service/maintenance/useGlobalProcessor.h
@@ -12,9 +12,9 @@ namespace Gentoo {
public:
static const int FILETYPEID;
- void created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const;
- void modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const;
- void deleted(DB::Connection * dbc, const boost::filesystem::path & fn) const;
+ void created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) override;
+ void modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) override;
+ void deleted(DB::Connection * dbc, const boost::filesystem::path & fn) override;
};
}
}
diff --git a/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp b/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp
index 0689b1b..9749ba7 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;
void
- UseGroupProcessor::created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const
+ UseGroupProcessor::created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path)
{
auto m = dbc->select(sql::maintenance::useGroupsInsert.getSql());
m->bindParamS(0, fn.stem().string());
@@ -29,7 +29,7 @@ namespace Gentoo {
}
void
- UseGroupProcessor::modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const
+ UseGroupProcessor::modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path)
{
auto m = dbc->select(sql::maintenance::useGroupsGetId.getSql());
m->bindParamS(0, fn.stem().string());
@@ -39,7 +39,7 @@ namespace Gentoo {
}
void
- UseGroupProcessor::mergeContent(DB::Connection * dbc, const boost::filesystem::path & path, int64_t useGroupId) const
+ UseGroupProcessor::mergeContent(DB::Connection * dbc, const boost::filesystem::path & path, int64_t useGroupId)
{
DB::TablePatch p;
p.dest = "gentoobrowse.use_group";
@@ -70,7 +70,7 @@ namespace Gentoo {
}
void
- UseGroupProcessor::deleted(DB::Connection * dbc, const boost::filesystem::path & fn) const
+ UseGroupProcessor::deleted(DB::Connection * dbc, const boost::filesystem::path & fn)
{
auto m = dbc->modify(sql::maintenance::useGroupsDelete.getSql());
m->bindParamS(0, fn.stem().string());
diff --git a/gentoobrowse-api/service/maintenance/useGroupProcessor.h b/gentoobrowse-api/service/maintenance/useGroupProcessor.h
index dc328ce..af230df 100644
--- a/gentoobrowse-api/service/maintenance/useGroupProcessor.h
+++ b/gentoobrowse-api/service/maintenance/useGroupProcessor.h
@@ -12,12 +12,12 @@ namespace Gentoo {
public:
static const int FILETYPEID;
- void created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const;
- void modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const;
- void deleted(DB::Connection * dbc, const boost::filesystem::path & fn) const;
+ void created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) override;
+ void modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) override;
+ void deleted(DB::Connection * dbc, const boost::filesystem::path & fn) override;
private:
- void mergeContent(DB::Connection *, const boost::filesystem::path &, int64_t id) const;
+ void mergeContent(DB::Connection *, const boost::filesystem::path &, int64_t id);
};
}
}
diff --git a/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp b/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp
index e89ddfc..1738e9c 100644
--- a/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp
+++ b/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp
@@ -16,13 +16,13 @@ namespace Gentoo {
const int UseLocalProcessor::FILETYPEID = 6;
void
- UseLocalProcessor::created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const
+ UseLocalProcessor::created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path)
{
modified(dbc, fn, path);
}
void
- UseLocalProcessor::modified(DB::Connection * dbc, const boost::filesystem::path &, const boost::filesystem::path & path) const
+ UseLocalProcessor::modified(DB::Connection * dbc, const boost::filesystem::path &, const boost::filesystem::path & path)
{
DB::TablePatch p;
auto tempTable = Utils::Database::namedTemp(dbc, "tmp_uselocalraw", {
@@ -54,7 +54,7 @@ namespace Gentoo {
}
void
- UseLocalProcessor::deleted(DB::Connection * dbc, const boost::filesystem::path &) const
+ UseLocalProcessor::deleted(DB::Connection * dbc, const boost::filesystem::path &)
{
dbc->modify("DELETE FROM gentoobrowse.use_local")->execute();
}
diff --git a/gentoobrowse-api/service/maintenance/useLocalProcessor.h b/gentoobrowse-api/service/maintenance/useLocalProcessor.h
index ab0663d..b4cb36e 100644
--- a/gentoobrowse-api/service/maintenance/useLocalProcessor.h
+++ b/gentoobrowse-api/service/maintenance/useLocalProcessor.h
@@ -12,9 +12,9 @@ namespace Gentoo {
public:
static const int FILETYPEID;
- void created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const;
- void modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const;
- void deleted(DB::Connection * dbc, const boost::filesystem::path & fn) const;
+ void created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) override;
+ void modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) override;
+ void deleted(DB::Connection * dbc, const boost::filesystem::path & fn) override;
};
}
}
diff --git a/gentoobrowse-api/service/maintenanceimpl.cpp b/gentoobrowse-api/service/maintenanceimpl.cpp
index bbece65..c2629fe 100644
--- a/gentoobrowse-api/service/maintenanceimpl.cpp
+++ b/gentoobrowse-api/service/maintenanceimpl.cpp
@@ -37,17 +37,32 @@ namespace Gentoo {
}
void
- Maintenance::FileProcessor::created(DB::Connection *, const boost::filesystem::path &, const boost::filesystem::path &) const
+ Maintenance::FileProcessor::prepare(DB::Connection *)
{
}
void
- Maintenance::FileProcessor::modified(DB::Connection *, const boost::filesystem::path &, const boost::filesystem::path &) const
+ Maintenance::FileProcessor::apply(DB::Connection *)
{
}
void
- Maintenance::FileProcessor::deleted(DB::Connection *, const boost::filesystem::path &) const
+ Maintenance::FileProcessor::tidy(DB::Connection *)
+ {
+ }
+
+ void
+ Maintenance::FileProcessor::created(DB::Connection *, const boost::filesystem::path &, const boost::filesystem::path &)
+ {
+ }
+
+ void
+ Maintenance::FileProcessor::modified(DB::Connection *, const boost::filesystem::path &, const boost::filesystem::path &)
+ {
+ }
+
+ void
+ Maintenance::FileProcessor::deleted(DB::Connection *, const boost::filesystem::path &)
{
}
@@ -139,6 +154,9 @@ namespace Gentoo {
for (const auto & fpf : fpfs) {
fps[fpf.first] = fpf.second();
}
+ for (const auto & fp : fps) {
+ fp.second->prepare(dbc);
+ }
DB::StaticSqlWriter src(sql::maintenance::fileList.getSql());
DB::TablePatch tp;
tp.srcExpr = &src;
@@ -151,8 +169,14 @@ namespace Gentoo {
DB::StaticSqlWriter obpo("processOrder NULLS LAST");
tp.order = &obpo;
dbc->patchTable(&tp);
+ for (const auto & fp : fps) {
+ fp.second->apply(dbc);
+ }
boost::filesystem::remove_all(tmp);
dbc->execute("DROP TABLE filelist");
+ for (const auto & fp : fps) {
+ fp.second->tidy(dbc);
+ }
}
void
diff --git a/gentoobrowse-api/service/maintenanceimpl.h b/gentoobrowse-api/service/maintenanceimpl.h
index 378cbd1..6331672 100644
--- a/gentoobrowse-api/service/maintenanceimpl.h
+++ b/gentoobrowse-api/service/maintenanceimpl.h
@@ -15,11 +15,15 @@ namespace Gentoo {
public:
virtual ~FileProcessor() = 0;
- virtual void created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const;
- virtual void modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const;
- virtual void deleted(DB::Connection * dbc, const boost::filesystem::path & fn) const;
+ virtual void prepare(DB::Connection *);
+ virtual void apply(DB::Connection *);
+ virtual void tidy(DB::Connection *);
+
+ virtual void created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path);
+ virtual void modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path);
+ virtual void deleted(DB::Connection * dbc, const boost::filesystem::path & fn);
};
- typedef boost::shared_ptr<const FileProcessor> FileProcessorPtr;
+ typedef boost::shared_ptr<FileProcessor> FileProcessorPtr;
typedef std::map<int64_t, boost::function<FileProcessorPtr()>> FileProcessorFactories;
typedef std::map<int64_t, FileProcessorPtr> FileProcessors;