Working on g++ compatibility
[invirt/third/libt4.git] / paxos.h
diff --git a/paxos.h b/paxos.h
index 116403d..db18e6c 100644 (file)
--- a/paxos.h
+++ b/paxos.h
@@ -7,10 +7,9 @@
 #include "log.h"
 
 using prepareres = paxos_protocol::prepareres;
-
-using node_t = string;
-using nodes_t = vector<node_t>;
-using value_t = string;
+using node_t = paxos_protocol::node_t;
+using nodes_t = paxos_protocol::nodes_t;
+using value_t = paxos_protocol::value_t;
 
 class paxos_change {
     public:
@@ -20,7 +19,6 @@ class paxos_change {
 
 extern bool isamember(const node_t & m, const nodes_t & nodes);
 extern bool majority(const nodes_t & l1, const nodes_t & l2);
-extern string print_members(const nodes_t & nodes);
 
 class proposer_acceptor {
     private:
@@ -30,24 +28,24 @@ class proposer_acceptor {
         paxos_change *delegate;
         node_t me;
 
-        rpcs pxs = {(uint32_t)std::stoi(me)};
+        rpcs pxs{(in_port_t)stoi(me)};
 
         bool break1 = false;
         bool break2 = false;
 
         // Proposer state
         bool stable = true;
-        prop_t my_n = {0, me};      // number of the last proposal used in this instance
+        prop_t proposal = {0, me};  // number of the last proposal used in this instance
 
         // Acceptor state
-        prop_t n_h = {0, me};       // number of the highest proposal seen in a prepare
-        prop_t n_a = {0, me};       // number of highest proposal accepted
-        value_t v_a;                // value of highest proposal accepted
+        prop_t promise = {0, me};   // number of the highest proposal seen in a prepare
+        prop_t accepted = {0, me};  // number of highest proposal accepted
+        value_t accepted_value;     // value of highest proposal accepted
         unsigned instance_h = 0;    // number of the highest instance we have decided
         map<unsigned,value_t> values;   // vals of each instance
 
         friend class log;
-        log l = {this, me};
+        class log l = {this, me};
 
         void commit(unsigned instance, const value_t & v);
         void commit(unsigned instance, const value_t & v, lock & pxs_mutex_lock);