projects
/
invirt/third/libt4.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
MOAR TEMPLATE MAGIC
[invirt/third/libt4.git]
/
config.cc
diff --git
a/config.cc
b/config.cc
index
d1cd70a
..
038a100
100644
(file)
--- a/
config.cc
+++ b/
config.cc
@@
-61,15
+61,11
@@
void config::get_view(unsigned instance, vector<string> &m, lock &) {
}
vector<string> config::members(const string &value) const {
}
vector<string> config::members(const string &value) const {
- istringstream ist(value);
- using it = istream_iterator<string>;
- return {it(ist), it()};
+ return explode(value);
}
}
-string config::value(const vector<string> &m) const {
- ostringstream ost;
- copy(m.begin(), m.end(), ostream_iterator<string>(ost, " "));
- return ost.str();
+string config::value(const vector<string> &members) const {
+ return implode(members);
}
void config::reconstruct(lock &cfg_mutex_lock) {
}
void config::reconstruct(lock &cfg_mutex_lock) {
@@
-77,7
+73,7
@@
void config::reconstruct(lock &cfg_mutex_lock) {
my_view_id = paxos.instance();
if (my_view_id > 0) {
get_view(my_view_id, mems, cfg_mutex_lock);
my_view_id = paxos.instance();
if (my_view_id > 0) {
get_view(my_view_id, mems, cfg_mutex_lock);
- LOG("config::reconstruct: " << my_view_id << " " << print_members(mems));
+ LOG("config::reconstruct: " << my_view_id << " " << mems);
}
}
}
}
@@
-86,7
+82,7
@@
void config::paxos_commit(unsigned instance, const string &value) {
lock cfg_mutex_lock(cfg_mutex);
vector<string> newmem = members(value);
lock cfg_mutex_lock(cfg_mutex);
vector<string> newmem = members(value);
- LOG("config::paxos_commit: " << instance << ": " << print_members(newmem));
+ LOG("config::paxos_commit: " << instance << ": " << newmem);
for (auto mem : mems) {
LOG("config::paxos_commit: is " << mem << " still a member?");
for (auto mem : mems) {
LOG("config::paxos_commit: is " << mem << " still a member?");
@@
-114,17
+110,20
@@
bool config::ismember(const string &m, unsigned vid) {
bool config::add(const string &new_m, unsigned vid) {
lock cfg_mutex_lock(cfg_mutex);
bool config::add(const string &new_m, unsigned vid) {
lock cfg_mutex_lock(cfg_mutex);
- if (vid != my_view_id)
+ LOG("adding " << new_m << " to " << vid);
+ if (vid != my_view_id) {
+ LOG("that's not my view id, " << my_view_id << "!");
return false;
return false;
- LOG("config::add " << new_m);
+ }
vector<string> m = mems;
m.push_back(new_m);
vector<string> cmems = mems;
unsigned nextvid = my_view_id + 1;
vector<string> m = mems;
m.push_back(new_m);
vector<string> cmems = mems;
unsigned nextvid = my_view_id + 1;
+ LOG("calling down to paxos layer");
cfg_mutex_lock.unlock();
bool r = paxos.run(nextvid, cmems, value(m));
cfg_mutex_lock.lock();
cfg_mutex_lock.unlock();
bool r = paxos.run(nextvid, cmems, value(m));
cfg_mutex_lock.lock();
- LOG("config::add: proposer returned " << (r ? "success" : "failure"));
+ LOG("paxos proposer returned " << (r ? "success" : "failure"));
return r;
}
return r;
}
@@
-156,7
+155,7
@@
void config::heartbeater() [[noreturn]] {
unsigned vid = my_view_id;
vector<string> cmems;
get_view(vid, cmems, cfg_mutex_lock);
unsigned vid = my_view_id;
vector<string> cmems;
get_view(vid, cmems, cfg_mutex_lock);
- LOG("heartbeater: current membership " << print_members(cmems));
+ LOG("heartbeater: current membership " << cmems);
if (!isamember(me, cmems)) {
LOG("heartbeater: not member yet; skip hearbeat");
if (!isamember(me, cmems)) {
LOG("heartbeater: not member yet; skip hearbeat");