summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentoobrowse-api/service/maintenanceimpl.cpp21
-rw-r--r--gentoobrowse-api/service/maintenanceimpl.h5
2 files changed, 13 insertions, 13 deletions
diff --git a/gentoobrowse-api/service/maintenanceimpl.cpp b/gentoobrowse-api/service/maintenanceimpl.cpp
index f0247c7..8592313 100644
--- a/gentoobrowse-api/service/maintenanceimpl.cpp
+++ b/gentoobrowse-api/service/maintenanceimpl.cpp
@@ -28,32 +28,29 @@ namespace Gentoo {
{
}
- static
void
- fileDeleted(DB::Connection * dbc, const boost::filesystem::path &, DB::SelectCommandPtr s)
+ Maintenance::fileDeleted(DB::Connection * dbc, const boost::filesystem::path & tmp, DB::SelectCommandPtr s)
{
// b.filename, b.filesize, b.filetypeid, b.moddate, b.pathparts, b.repoid
- s->forEachRow<std::string, int64_t, int64_t, boost::posix_time::ptime, std::string, int64_t>([dbc](auto fn, auto, auto, auto, auto, auto) {
+ s->forEachRow<std::string, int64_t, int64_t, boost::posix_time::ptime, std::string, int64_t>([dbc,&tmp](auto fn, auto, auto, auto, auto, auto) {
fprintf(stderr, "deleted file: %s\n", fn.c_str());
});
}
- static
void
- fileChanged(DB::Connection * dbc, const boost::filesystem::path &, DB::SelectCommandPtr s)
+ Maintenance::fileChanged(DB::Connection * dbc, const boost::filesystem::path & tmp, DB::SelectCommandPtr s)
{
// a.filename, a.repoid, a.filesize old_filesize, a.filetypeid old_filetypeid, a.moddate old_moddate, a.pathparts old_pathparts, b.filesize new_filesize, b.filetypeid new_filetypeid, b.moddate new_moddate, b.pathparts new_pathparts
- s->forEachRow<std::string, int64_t, int64_t, int64_t, boost::posix_time::ptime, std::string, int64_t, int64_t, boost::posix_time::ptime, std::string>([dbc](auto fn, auto, auto, auto, auto, auto, auto, auto, auto, auto) {
+ s->forEachRow<std::string, int64_t, int64_t, int64_t, boost::posix_time::ptime, std::string, int64_t, int64_t, boost::posix_time::ptime, std::string>([dbc,&tmp](auto fn, auto, auto, auto, auto, auto, auto, auto, auto, auto) {
fprintf(stderr, "updated file: %s\n", fn.c_str());
});
}
- static
void
- fileCreated(DB::Connection * dbc, const boost::filesystem::path &, DB::SelectCommandPtr s)
+ Maintenance::fileCreated(DB::Connection * dbc, const boost::filesystem::path & tmp, DB::SelectCommandPtr s)
{
// b.filename, b.filesize, b.filetypeid, b.moddate, b.pathparts, b.repoid
- s->forEachRow<std::string, int64_t, int64_t, boost::posix_time::ptime, std::string, int64_t>([dbc](auto fn, auto, auto, auto, auto, auto) {
+ s->forEachRow<std::string, int64_t, int64_t, boost::posix_time::ptime, std::string, int64_t>([dbc,&tmp](auto fn, auto, auto, auto, auto, auto) {
fprintf(stderr, "new file: %s\n", fn.c_str());
});
}
@@ -96,9 +93,9 @@ namespace Gentoo {
tp.dest = "gentoobrowse.files";
tp.pk = {"repoid", "filename"};
tp.cols = {"repoid", "filename", "filetypeid", "pathparts", "filesize", "moddate"};
- tp.beforeDelete = boost::bind(&fileDeleted, dbc, tmp, _1);
- tp.beforeUpdate = boost::bind(&fileChanged, dbc, tmp, _1);
- tp.beforeInsert = boost::bind(&fileCreated, dbc, tmp, _1);
+ tp.beforeDelete = boost::bind(&Maintenance::fileDeleted, this, dbc, tmp, _1);
+ tp.beforeUpdate = boost::bind(&Maintenance::fileChanged, this, dbc, tmp, _1);
+ tp.beforeInsert = boost::bind(&Maintenance::fileCreated, this, dbc, tmp, _1);
OrderByProcessOrder obpo;
tp.order = &obpo;
dbc->patchTable(&tp);
diff --git a/gentoobrowse-api/service/maintenanceimpl.h b/gentoobrowse-api/service/maintenanceimpl.h
index 19b2872..baa8783 100644
--- a/gentoobrowse-api/service/maintenanceimpl.h
+++ b/gentoobrowse-api/service/maintenanceimpl.h
@@ -15,7 +15,10 @@ namespace Gentoo {
private:
static void createTempFileList(DB::Connection *, const boost::filesystem::path &);
- static void processChanges(DB::Connection *, const boost::filesystem::path &);
+ void processChanges(DB::Connection *, const boost::filesystem::path &);
+ void fileDeleted(DB::Connection * dbc, const boost::filesystem::path &, DB::SelectCommandPtr s);
+ void fileChanged(DB::Connection * dbc, const boost::filesystem::path &, DB::SelectCommandPtr s);
+ void fileCreated(DB::Connection * dbc, const boost::filesystem::path & tmp, DB::SelectCommandPtr s);
};
}
}