-
Notifications
You must be signed in to change notification settings - Fork 0
/
nnodes.tcc
51 lines (43 loc) · 1.31 KB
/
nnodes.tcc
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
#include "rpc_msg.hh"
#include "log.hh"
#include "network.hh"
#include "mpfd.hh"
#include "json.hh"
#include "clp.h"
#include "paxos.hh"
using namespace paxos;
tamed void run(int n, int ssp, int psp) {
tvars {
std::vector<Paxos_Server*> ps(n);
Json config = Json::make_array();
int i;
}
for (i = 0; i < n; ++i)
config.push_back(Json::array(ssp + i, psp + i));
for (i = 0; i < n; ++i)
ps[i] = new Paxos_Server(ssp + i, psp + i, config);
}
static Clp_Option options[] = {
{ "nnodes", 'n', 0, Clp_ValInt, 0 },
{ "server_port", 's', 0, Clp_ValInt, 0 },
{ "paxos_port", 'p', 0, Clp_ValInt , 0 }
};
int main(int argc, char** argv) {
Clp_Parser* clp = Clp_NewParser(argc,argv,sizeof(options) / sizeof(options[0]), options);
int nnodes = 1;
int server_start_port = 15800;
int paxos_start_port = 15900;
while (Clp_Next(clp) != Clp_Done) {
if (Clp_IsLong(clp,"nnodes"))
nnodes = clp->val.i;
else if (Clp_IsLong(clp,"server_port"))
server_start_port = clp->val.i;
else if (Clp_IsLong(clp,"nnodes"))
paxos_start_port = clp->val.i;
}
system("rm -rf *_persist log.txt");
tamer::initialize();
run(nnodes,server_start_port,paxos_start_port);
tamer::loop();
tamer::cleanup();
}