X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/2546a41ad36fdc9ef6471cb35a1d56930ae1b527..5bb7eb131773abd9e642f83629528b4c4e706b2e:/config.h diff --git a/config.h b/config.h index 074cbe9..73940a0 100644 --- a/config.h +++ b/config.h @@ -1,23 +1,8 @@ #ifndef config_h #define config_h -#include -#include +#include "types.h" #include "paxos.h" -#include "lock.h" - -using std::chrono::steady_clock; -using std::chrono::seconds; -using std::string; -using std::vector; -using std::thread; -using std::ostringstream; -using std::istringstream; -using std::ostream_iterator; -using std::istream_iterator; -using std::copy; -using std::min; -using std::min_element; class config_view_change { public: @@ -31,8 +16,7 @@ class config : public paxos_change { string first; string me; config_view_change *vc; - acceptor paxos_acceptor; - proposer paxos_proposer; + proposer_acceptor paxos; vector mems; mutex cfg_mutex; cond config_cond; @@ -43,25 +27,24 @@ class config : public paxos_change { 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 string &m, lock &cfg_mutex_lock); public: config(const string &_first, const string &_me, config_view_change *_vc); unsigned view_id() { return my_view_id; } const string &myaddr() const { return me; } - string dump() { return paxos_acceptor.dump(); } + string dump() { return paxos.dump(); } void get_view(unsigned instance, vector &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 string &v); - // XXX hack; maybe should have its own port number - rpcs *get_rpcs() { return paxos_acceptor.get_rpcs(); } - void breakpoint(int b) { paxos_proposer.breakpoint(b); } + rpcs *get_rpcs() { return paxos.get_rpcs(); } + void breakpoint(int b) { paxos.breakpoint(b); } }; #endif