Renamed a method that isn't part of the public interface of unmarshall
[invirt/third/libt4.git] / config.h
index cd276fb..73940a0 100644 (file)
--- a/config.h
+++ b/config.h
@@ -1,58 +1,50 @@
 #ifndef config_h
 #define config_h
 
-#include <string>
-#include <vector>
+#include "types.h"
 #include "paxos.h"
-#include "lock.h"
 
 class config_view_change {
     public:
         virtual void commit_change(unsigned view_id) = 0;
-        virtual ~config_view_change() {};
+        virtual ~config_view_change() {}
 };
 
 class config : public paxos_change {
     private:
-        acceptor *paxos_acceptor;
-        proposer *paxos_proposer;
         unsigned my_view_id;
-        std::string first;
-        std::string me;
+        string first;
+        string me;
         config_view_change *vc;
-        std::vector<std::string> mems;
+        proposer_acceptor paxos;
+        vector<string> mems;
         mutex cfg_mutex;
-        std::condition_variable config_cond;
-        paxos_protocol::status heartbeat(
-                std::string m,
-                unsigned instance,
-                int &r);
-        std::string value(const std::vector<std::string> &mems) const;
-        void members(const std::string &v, std::vector<std::string> &m) const;
-        void get_view_wo(unsigned instance, std::vector<std::string> &m);
-        bool remove(const std::string &);
-        void reconstruct();
+        cond config_cond;
+        paxos_protocol::status heartbeat(int &r, string m, unsigned instance);
+        string value(const vector<string> &mems) const;
+        vector<string> members(const string &v) const;
+        void get_view(unsigned instance, vector<string> &m, lock &cfg_mutex_lock);
+        bool remove(const string &, lock &cfg_mutex_lock);
+        void reconstruct(lock &cfg_mutex_lock);
         typedef enum {
-            OK,        // response and same view #
-            VIEWERR,   // response but different view #
-            FAILURE,   // no response
+            OK, // response and same view #
+            VIEWERR, // response but different view #
+            FAILURE, // no response
         } heartbeat_t;
-        heartbeat_t doheartbeat(const std::string &m);
+        heartbeat_t doheartbeat(const string &m, lock &cfg_mutex_lock);
     public:
-        config(const std::string &_first,
-               const std::string &_me,
-               config_view_change *_vc);
+        config(const string &_first, const string &_me, config_view_change *_vc);
         unsigned view_id() { return my_view_id; }
-        const std::string &myaddr() const { return me; };
-        std::string dump() { return paxos_acceptor->dump(); };
-        void get_view(unsigned instance, std::vector<std::string> &m);
-        void restore(const std::string &s);
-        bool add(const std::string &, unsigned view_id);
-        bool ismember(const std::string &m, unsigned view_id);
+        const string &myaddr() const { return me; }
+        string dump() { return paxos.dump(); }
+        void get_view(unsigned instance, vector<string> &m);
+        void restore(const string &s);
+        bool add(const string &, unsigned view_id);
+        bool ismember(const string &m, unsigned view_id);
         void heartbeater(void);
-        void paxos_commit(unsigned instance, const std::string &v);
-        rpcs *get_rpcs() { return paxos_acceptor->get_rpcs(); }
-        void breakpoint(int b) { paxos_proposer->breakpoint(b); }
+        void paxos_commit(unsigned instance, const string &v);
+        rpcs *get_rpcs() { return paxos.get_rpcs(); }
+        void breakpoint(int b) { paxos.breakpoint(b); }
 };
 
 #endif