-inline unmarshall & operator>>(unmarshall &u, prop_t &a) {
- return u >> a.n >> a.m;
-}
-
-inline marshall & operator<<(marshall &m, prop_t a) {
- return m << a.n << a.m;
-}
-
-inline unmarshall & operator>>(unmarshall &u, paxos_protocol::preparearg &a) {
- return u >> a.instance >> a.n;
-}
-
-inline marshall & operator<<(marshall &m, paxos_protocol::preparearg a) {
- return m << a.instance << a.n;
-}
-
-inline unmarshall & operator>>(unmarshall &u, paxos_protocol::prepareres &r) {
- return u >> r.oldinstance >> r.accept >> r.n_a >> r.v_a;
-}
-
-inline marshall & operator<<(marshall &m, paxos_protocol::prepareres r) {
- return m << r.oldinstance << r.accept << r.n_a << r.v_a;
-}
-
-inline unmarshall & operator>>(unmarshall &u, paxos_protocol::acceptarg &a) {
- return u >> a.instance >> a.n >> a.v;
-}
-
-inline marshall & operator<<(marshall &m, paxos_protocol::acceptarg a) {
- return m << a.instance << a.n << a.v;
-}
-
-inline unmarshall & operator>>(unmarshall &u, paxos_protocol::decidearg &a) {
- return u >> a.instance >> a.v;
-}
+MARSHALLABLE_STRUCT(prop_t)
+
+namespace paxos_protocol {
+ enum status : rpc_protocol::status { OK, ERR };
+ struct prepareres {
+ bool oldinstance;
+ bool accept;
+ prop_t n_a;
+ string v_a;
+
+ MEMBERS(oldinstance, accept, n_a, v_a)
+ };
+ using node_t = string;
+ using nodes_t = vector<node_t>;
+ using value_t = string;
+
+ REMOTE_PROCEDURE_BASE(0x11000);
+ REMOTE_PROCEDURE(1, preparereq, (prepareres &, node_t, unsigned, prop_t));
+ REMOTE_PROCEDURE(2, acceptreq, (bool &, node_t, unsigned, prop_t, value_t));
+ REMOTE_PROCEDURE(3, decidereq, (int &, node_t, unsigned, value_t));
+ REMOTE_PROCEDURE(4, heartbeat, (int &, string, unsigned));
+};