int handle_status(const char* name) { DB_VDA_FILE dvf; char buf[1024]; sprintf(buf, "where file_name='%s'", name); int retval = dvf.lookup(buf); if (retval) return retval; VDA_FILE_AUX vf = dvf; sprintf(buf, "%s/boinc_meta.txt", vf.dir); retval = vf.policy.parse(buf); if (retval) { log_messages.printf(MSG_CRITICAL, "Can't parse policy file %s\n", buf); return retval; } retval = vf.get_state(); if (retval) { log_messages.printf(MSG_CRITICAL, "Can't get file state: %d\n", retval); return retval; } printf("status for file %s:\n", vf.file_name); vf.meta_chunk->recovery_plan(); vf.meta_chunk->compute_min_failures(); vf.meta_chunk->print_status(0); printf("fault tolerance level: %d\n", vf.meta_chunk->min_failures-1); if (vf.retrieving) { if (vf.retrieved) { printf("Retrieving: completed\n"); } else { printf("Retrieving: in progress\n"); } } return 0; }
int handle_file(VDA_FILE_AUX& vf, DB_VDA_FILE& dvf) { int retval; char buf[1024]; log_messages.printf(MSG_NORMAL, "processing file %s\n", vf.file_name); // read the policy file // sprintf(buf, "%s/boinc_meta.txt", vf.dir); retval = vf.policy.parse(buf); if (retval) { log_messages.printf(MSG_CRITICAL, "Can't parse policy file %s\n", buf); return retval; } if (vf.initialized) { retval = vf.get_state(); if (retval) { log_messages.printf(MSG_CRITICAL, "vf.get_state failed %d\n", retval); return retval; } } else { retval = vf.init(); if (retval) { log_messages.printf(MSG_CRITICAL, "vf.init failed %d\n", retval); return retval; } sprintf(buf, "initialized=1, chunk_size=%.0f", vf.policy.chunk_size()); dvf.update_field(buf); } retval = vf.meta_chunk->recovery_plan(); if (retval) { log_messages.printf(MSG_CRITICAL, "vf.recovery_plan failed %d\n", retval); return retval; } retval = vf.meta_chunk->recovery_action(dtime()); if (retval) { log_messages.printf(MSG_CRITICAL, "vf.recovery_action failed %d\n", retval); return retval; } return 0; }
int handle_status(const char* name) { DB_VDA_FILE dvf; char buf[1024]; sprintf(buf, "where file_name='%s'", name); int retval = dvf.lookup(buf); if (retval) return retval; VDA_FILE_AUX vf = dvf; sprintf(buf, "%s/boinc_meta.txt", vf.dir); retval = vf.policy.parse(buf); if (retval) { log_messages.printf(MSG_CRITICAL, "Can't parse policy file %s\n", buf); return retval; } retval = vf.get_state(); if (retval) { log_messages.printf(MSG_CRITICAL, "Can't get file state: %d\n", retval); return retval; } printf("status for file %s:", vf.file_name); vf.meta_chunk->print_status(0); return 0; }