-bool operator> (const prop_t &a, const prop_t &b) {
- return (a.n > b.n || (a.n == b.n && a.m > b.m));
-}
-
-bool operator>= (const prop_t &a, const prop_t &b) {
- return (a.n > b.n || (a.n == b.n && a.m >= b.m));
-}
-
-std::string
-print_members(const std::vector<std::string> &nodes) {
- std::string s;
- s.clear();
- for (unsigned i = 0; i < nodes.size(); i++) {
- s += nodes[i];
- if (i < (nodes.size()-1))
- s += ",";
- }
- return s;
-}
-
-
-bool isamember(const std::string & m, const std::vector<std::string> & nodes) {
- for (auto n : nodes) {
- if (n == m)
- return 1;
- }
- return 0;
-}
-
-bool proposer::isrunning() {
- bool r;
- lock ml(pxs_mutex);
- r = !stable;
- return r;
-}
-
-// check if the servers in l2 contains a majority of servers in l1
-bool proposer::majority(const std::vector<std::string> &l1,
- const std::vector<std::string> &l2) {
- unsigned n = 0;
-
- for (unsigned i = 0; i < l1.size(); i++) {
- if (isamember(l1[i], l2))
- n++;
+proposer_acceptor::proposer_acceptor(paxos_change *_delegate,
+ bool _first, const node_t & _me, const value_t & _value)
+ : delegate(_delegate), me (_me)
+{
+ // at this point, the log has already been replayed
+ if (instance_h == 0 && _first) {
+ values[1] = _value;
+ l.loginstance(1, _value);
+ instance_h = 1;