From 86dd953c0662b0c63306af44db1d11483ea05569 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 23 Jan 2012 08:04:41 +0000 Subject: [PATCH] - data archival stuff svn path=/trunk/boinc/; revision=25128 --- vda/makefile | 10 ++++++++-- vda/ssim.cpp | 2 +- vda/vda_lib.cpp | 2 +- vda/vda_transitioner.cpp | 19 +++++++++++++------ 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/vda/makefile b/vda/makefile index 58b131de6e..ed5fcfff61 100644 --- a/vda/makefile +++ b/vda/makefile @@ -1,10 +1,16 @@ all: ssim vda vda_transitioner +CCFLAGS = -I /usr/include/mysql -I ../db -I ../lib + +LIBS = ../sched/libsched.a ../lib/libboinc.a + +MYSQL_LIBS = -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lrt -lssl -lcrypto -ldl + vda_lib.o: vda_lib.cpp vda_lib.h g++ -c vda_lib.cpp ssim: ssim.cpp des.h vda_lib.o g++ -g -Wall -o ssim ssim.cpp vda_lib.o vda_transitioner: vda_transitioner.cpp vda_lib.o - g++ -g -Wall -o vda_transitioner vda_transitioner.cpp vda_lib.o + g++ -g $(CCFLAGS) -Wall -o vda_transitioner vda_transitioner.cpp vda_lib.o $(LIBS) $(MYSQL_LIBS) vda: vda.cpp vda_lib.o - g++ -g -Wall -o vda vda.cpp vda_lib.o + g++ -g $(CCFLAGS) -Wall -o vda vda.cpp vda_lib.o $(LIBS) $(MYSQL_LIBS) diff --git a/vda/ssim.cpp b/vda/ssim.cpp index 7b745361e6..0d82ae92ab 100644 --- a/vda/ssim.cpp +++ b/vda/ssim.cpp @@ -41,7 +41,7 @@ #include #include "des.h" -#include "vda.h" +#include "vda_lib.h" using std::set; diff --git a/vda/vda_lib.cpp b/vda/vda_lib.cpp index 114e3c4c9e..3e2ac4965e 100644 --- a/vda/vda_lib.cpp +++ b/vda/vda_lib.cpp @@ -18,7 +18,7 @@ #include #include -#include "vda.h" +#include "vda_lib.h" int POLICY::parse(const char* filename) { int n; diff --git a/vda/vda_transitioner.cpp b/vda/vda_transitioner.cpp index 52338de228..e1e54db776 100644 --- a/vda/vda_transitioner.cpp +++ b/vda/vda_transitioner.cpp @@ -17,6 +17,8 @@ #include "boinc_db.h" +#include "util.h" + void handle_file(VDA_FILE& vf) { } @@ -24,28 +26,33 @@ bool scan_files() { DB_VDA_FILE vf; bool found = false; - while (vda_file.enum("need_update<>0")) { + while (vf.enumerate("need_update<>0")) { found = true; handle_file(vf); } return found; } -void handle_chunk(VDA_CHUNK_HOST* ch) { +void handle_chunk(VDA_CHUNK_HOST& ch) { } -void scan_chunks() { +bool scan_chunks() { DB_VDA_CHUNK_HOST ch; + char buf[256]; + bool found = false; - double now = dtime(); - while (ch.enum("transition_time < %f")) { + sprintf(buf, "transition_time < %f", dtime()); + while (ch.enumerate(buf)) { + found = true; + handle_chunk(ch); } + return found; } int main(int argc, char** argv) { while(1) { bool action = scan_files(); - action != scan_chunks(); + action |= scan_chunks(); if (!action) boinc_sleep(5.); } }