#ifndef config_h
#define config_h
-#include <string>
-#include <vector>
+#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:
string first;
string me;
config_view_change *vc;
- acceptor paxos_acceptor;
- proposer paxos_proposer;
+ proposer_acceptor paxos;
vector<string> mems;
mutex cfg_mutex;
cond config_cond;
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<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 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