X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/4e881433f37417ccbda89c09ffdf936855d462d4..06282fd37814c4a9d53bca089b048709b368f5b3:/config.h?ds=sidebyside diff --git a/config.h b/config.h index 7124a6e..d2b33ba 100644 --- a/config.h +++ b/config.h @@ -7,7 +7,7 @@ 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 { @@ -17,32 +17,30 @@ class config : public paxos_change { string me; config_view_change *vc; proposer_acceptor paxos; - vector mems; - mutex cfg_mutex; + std::vector mems; + std::mutex cfg_mutex; cond config_cond; - paxos_protocol::status heartbeat(int &r, string m, unsigned instance); - string value(const vector &mems) const; - vector members(const string &v) const; - void get_view(unsigned instance, vector &m, lock &cfg_mutex_lock); - bool remove(const string &, lock &cfg_mutex_lock); - void reconstruct(lock &cfg_mutex_lock); + paxos_protocol::status heartbeat(int & r, string m, unsigned instance); + void get_view(unsigned instance, std::vector & 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 } heartbeat_t; - heartbeat_t doheartbeat(const string &m, lock &cfg_mutex_lock); + heartbeat_t doheartbeat(const string & m, lock & cfg_mutex_lock); public: - config(const string &_first, const 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 string &myaddr() const { return me; } + const string & myaddr() const { return me; } string dump() { return paxos.dump(); } - void get_view(unsigned instance, vector &m); - void restore(const string &s); + void get_view(unsigned instance, std::vector & m); + void restore(const string & s); bool add(const string &, unsigned view_id); - bool ismember(const string &m, unsigned view_id); + bool ismember(const string & m, unsigned view_id); void heartbeater NORETURN (); - void paxos_commit(unsigned instance, const string &v); + void paxos_commit(unsigned instance, const string & v); rpcs *get_rpcs() { return paxos.get_rpcs(); } void breakpoint(int b) { paxos.breakpoint(b); } };