X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/5d99dbf06a14904944f5593c63705934bdfdcfb7..eb3d5c6416c0f0d1cad35e52af3231de7866fea8:/paxos.h diff --git a/paxos.h b/paxos.h index 186daab..2ddf583 100644 --- a/paxos.h +++ b/paxos.h @@ -7,15 +7,14 @@ #include "log.h" using prepareres = paxos_protocol::prepareres; - -using node_t = string; -using nodes_t = vector; -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: virtual void paxos_commit(unsigned instance, const value_t & v) = 0; - virtual ~paxos_change() {} + virtual ~paxos_change(); }; extern bool isamember(const node_t & m, const nodes_t & nodes); @@ -29,7 +28,7 @@ class proposer_acceptor { paxos_change *delegate; node_t me; - rpcs pxs = {(uint32_t)stoi(me)}; + rpcs pxs{(in_port_t)stoi(me)}; bool break1 = false; bool break2 = false; @@ -46,7 +45,7 @@ class proposer_acceptor { map 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); @@ -67,7 +66,7 @@ class proposer_acceptor { unsigned instance() { return instance_h; } const value_t & value(unsigned instance) { return values[instance]; } string dump() { return l.dump(); } - void restore(const string &s) { l.restore(s); l.logread(); } + void restore(const string & s) { l.restore(s); l.logread(); } rpcs *get_rpcs() { return &pxs; } bool run(unsigned instance, const nodes_t & cnodes, const value_t & v);