From 67d6ab7cf2e04ef070952cfe546f8f07861e5194 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 11 Mar 2012 01:51:07 +0000 Subject: [PATCH] - storage: add some code svn path=/trunk/boinc/; revision=25400 --- checkin_notes | 8 ++++ vda/ssim.cpp | 12 ++++++ vda/state.txt | 6 +-- vda/storage.txt | 1 + vda/vda_lib.cpp | 112 ++++++++++++++++++++++++++++++++++++++++++++---- vda/vda_lib.h | 26 +++++++++++ vda/vdad.cpp | 60 ++++++++++++++++++-------- 7 files changed, 197 insertions(+), 28 deletions(-) diff --git a/checkin_notes b/checkin_notes index 443704c0ad..981444b526 100644 --- a/checkin_notes +++ b/checkin_notes @@ -2526,3 +2526,11 @@ Rom 9 Mar 2012 samples/vboxwrapper/ vbox.cpp vboxwrapper.cpp + +David 10 Mar 2012 + - storage: add some code + + vda/ + vda_lib.cpp,h + ssim.cpp + vdad.cpp diff --git a/vda/ssim.cpp b/vda/ssim.cpp index 8d8188ca1b..89ebe780f2 100644 --- a/vda/ssim.cpp +++ b/vda/ssim.cpp @@ -450,6 +450,18 @@ void CHUNK::download_complete() { sfp->recover(); } +int META_CHUNK::encode() { + return 0; +} + +int META_CHUNK::decode() { + return 0; +} + +int DATA_UNIT::delete_file() { + return 0; +} + const char* status_str(int status) { switch (status) { case PRESENT: return "present"; diff --git a/vda/state.txt b/vda/state.txt index 7b275a15fd..3211501e7b 100644 --- a/vda/state.txt +++ b/vda/state.txt @@ -2,7 +2,7 @@ the processing of a dfile by the vdad DATA_UNIT - int status (PRESENT, RECOVERABLE, UNRECOVERABLE) + int status (PRESENT, RECOVERABLE, UNRECOVERABLE) bool keep_present unit is currently PRESENT keep enough descendant chunks on server so that @@ -12,10 +12,10 @@ DATA_UNIT start enough uploads to make it PRESENT META_CHUNK - bool need_reconstruct + bool need_reconstruct decode this unit during this pass. This is set only if some child is UNREC - bool needed_by_parent + bool needed_by_parent this unit is needed to reconstruct parent. (don't delete it after reconstructing) diff --git a/vda/storage.txt b/vda/storage.txt index 2de8cda9f5..9a578ed767 100644 --- a/vda/storage.txt +++ b/vda/storage.txt @@ -151,6 +151,7 @@ dir/ data_m040.vda 0/ data.vda (symlink to ../Coding/data_k001.vda) + these are retained even when the file is deleted if this is a meta-chunk: Coding/ diff --git a/vda/vda_lib.cpp b/vda/vda_lib.cpp index b9185a8421..bf4a092bca 100644 --- a/vda/vda_lib.cpp +++ b/vda/vda_lib.cpp @@ -15,6 +15,8 @@ // You should have received a copy of the GNU Lesser General Public License // along with BOINC. If not, see . +// Code that's shared by the simulator and vdad + #include #include @@ -51,12 +53,14 @@ META_CHUNK::META_CHUNK( j )); } + bottom_level = false; } else { for (int j=0; j coding.n) { + c.delete_file(); + npresent--; + c.new_present_on_server = false; + } + } + } + } + return 0; +} + +int META_CHUNK::expand() { + unsigned int i; + int retval; + + if (bottom_level) { + bool do_encode = false; + for (i=0; idfile->policy.replication); + } }; diff --git a/vda/vdad.cpp b/vda/vdad.cpp index 241b6c8b87..8eaae1eb89 100644 --- a/vda/vdad.cpp +++ b/vda/vdad.cpp @@ -80,25 +80,25 @@ void encoder_filename( // // The size of these chunks is returned in "size" // -int encode(const char* dir, CODING& c, double& size) { +int META_CHUNK::encode() { char cmd[1024]; sprintf(cmd, "cd %s; /mydisks/b/users/boincadm/vda_test/encoder %s %d %d cauchy_good 32 1024 500000", - dir, DATA_FILENAME, c.n, c.k + dir, DATA_FILENAME, coding.n, coding.k ); printf("%s\n", cmd); int s = system(cmd); if (WIFEXITED(s)) { - int status = WEXITSTATUS(s); - if (status != 32) return -1; // encoder returns 32 for some reason + int st = WEXITSTATUS(s); + if (st != 32) return -1; // encoder returns 32 for some reason } // make symlinks // - for (int i=0; idir, index); } // assign this chunk to a host @@ -302,17 +326,18 @@ META_CHUNK::META_CHUNK(VDA_FILE_AUX* d, META_CHUNK* p, int index) { // initialize a meta-chunk: // encode it, then recursively initialize its meta-chunk children // -int META_CHUNK::init(const char* dir, POLICY& p, int level) { +int META_CHUNK::init(const char* _dir, POLICY& p, int level) { double size; char child_dir[1024]; - CODING& c = p.codings[level]; - int retval = encode(dir, c, size); + strcpy(dir, _dir); + coding = p.codings[level]; + int retval = encode(); if (retval) return retval; - p.chunk_sizes[level] = size; + p.chunk_sizes[level] = child_size; if (level+1 < p.coding_levels) { - for (int i=0; iinit(child_dir, p, level+1); @@ -320,7 +345,7 @@ int META_CHUNK::init(const char* dir, POLICY& p, int level) { children.push_back(mc); } } else { - for (int i=0; i