diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-04-20 22:32:20 +0100 | 
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-04-25 21:25:34 +0100 | 
| commit | f0b98811b30116abf0d2ecd094cde216ca56979a (patch) | |
| tree | b60a71f2e36d7c8c416e59e03c4e96f7e6ca519d | |
| parent | Process file changes according to predefined config (diff) | |
| download | gentoobrowse-api-f0b98811b30116abf0d2ecd094cde216ca56979a.tar.bz2 gentoobrowse-api-f0b98811b30116abf0d2ecd094cde216ca56979a.tar.xz gentoobrowse-api-f0b98811b30116abf0d2ecd094cde216ca56979a.zip | |
Make file event handlers non-static
| -rw-r--r-- | gentoobrowse-api/service/maintenanceimpl.cpp | 21 | ||||
| -rw-r--r-- | gentoobrowse-api/service/maintenanceimpl.h | 5 | 
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);  		};  	}  } | 
