Commit d3451c38 authored by Aleksandr Konstantinov's avatar Aleksandr Konstantinov
Browse files

Making sqlite default option for jobs storage. Adding jobs storage conversion option to arcsync.

parent 3a8d0430
Pipeline #1764 passed with stage
in 69 minutes and 7 seconds
......@@ -168,6 +168,36 @@ int RUNMAIN(arcsync)(int argc, char **argv) {
return 1;
}
if (opt.convert) {
Arc::JobInformationStorage *jobstore = createJobInformationStorage(usercfg);
if (jobstore == NULL) {
std::cerr << Arc::IString("Warning: Unable to open job list file (%s), unknown format", usercfg.JobListFile()) << std::endl;
return 1;
}
// Read current jobs
std::list<Arc::Job> jobs;
if (!jobstore->ReadAll(jobs)) {
std::cerr << Arc::IString("Warning: Unable to read local list of jobs from file (%s)", usercfg.JobListFile()) << std::endl;
return 1;
}
// Delete existing database so new on is created with specified format
if (!jobstore->Clean()) {
std::cerr << Arc::IString("Warning: Unable to truncate local list of jobs in file (%s)", usercfg.JobListFile()) << std::endl;
return 1;
}
delete jobstore;
jobstore = createJobInformationStorage(usercfg);
if (jobstore == NULL) {
std::cerr << Arc::IString("Warning: Unable to create job list file (%s), jobs list is destroyed", usercfg.JobListFile()) << std::endl;
return 1;
}
if (!jobstore->Write(jobs)) {
std::cerr << Arc::IString("Warning: Failed to write local list of jobs into file (%s), jobs list is destroyed", usercfg.JobListFile()) << std::endl;
return 1;
}
return 0;
}
if (opt.timeout > 0)
usercfg.Timeout(opt.timeout);
......
......@@ -256,6 +256,7 @@ ClientOptions::ClientOptions(Client_t c,
keep(false),
forcesync(false),
truncate(false),
convert(false),
longlist(false),
printids(false),
same(false),
......@@ -318,6 +319,10 @@ ClientOptions::ClientOptions(Client_t c,
AddOption('T', "truncate",
istring("truncate the joblist before synchronizing"),
truncate);
AddOption('C', "convert",
istring("do not collect information, only convert jobs storage format"),
convert);
}
if (c == CO_INFO || c == CO_STAT) {
......
......@@ -138,6 +138,7 @@ public:
bool keep;
bool forcesync;
bool truncate;
bool convert;
bool longlist;
bool printids;
bool same;
......
......@@ -15,11 +15,11 @@
namespace Arc {
JobInformationStorageDescriptor JobInformationStorage::AVAILABLE_TYPES[] = {
#ifdef DBJSTORE_ENABLED
{ "BDB", &JobInformationStorageBDB::Instance },
#endif
#ifdef HAVE_SQLITE
{ "SQLITE", &JobInformationStorageSQLite::Instance },
#endif
#ifdef DBJSTORE_ENABLED
{ "BDB", &JobInformationStorageBDB::Instance },
#endif
{ "XML", &JobInformationStorageXML::Instance },
{ NULL, NULL }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment