forked from shenzr/fastpr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAzureLRCCoordinator.cc
53 lines (40 loc) · 2.52 KB
/
AzureLRCCoordinator.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <iostream>
#include <thread>
#include <vector>
#include "Coordinator.hh"
#include "FastPRUtil.hh"
using namespace std;
int main(int argc, char** argv){
if(argc != 4){
cout << "Usage: ./AzureLRCCoordinator" << endl;
cout << " 1. id of stf node" << endl;
cout << " 2. repair method" << endl;
cout << " 3. number of repaired chunks" << endl;
}
int stfnode = atoi(argv[1]);
string repairmethod = argv[2];
int chunknum = atoi(argv[3]);
Config* conf = new Config("metadata/config.xml");
string scenario = conf->_repair_scenario;
Coordinator *coord = new Coordinator(conf);
coord->getLostInfo(stfnode);
if (coord->getLostNum() < chunknum) {
cout << "ERROR: The number of chunks in the STF node is less than " << chunknum << endl;
return -1;
}
struct timeval begin_tm, end_tm;
gettimeofday(&begin_tm, NULL);
if (repairmethod == "fastpr") {
coord->fastprAzureLRCRepair(scenario);
} else if (repairmethod == "recon") {
coord->randomAzureLRCRepair(scenario);
} else if (repairmethod == "mig") {
coord->migrationAzureLRCRepair(scenario);
}
gettimeofday(&end_tm, NULL);
double time = FastPRUtil::duration(begin_tm, end_tm);
cout << "Repair Time: " << time / 1000 << "s" << endl;
cout << "Repair Num: " << coord->getLostNum() << endl;
delete coord;
return 0;
}