X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/2546a41ad36fdc9ef6471cb35a1d56930ae1b527..5a5c578e2e358a121cdb9234a6cb11c4ecfbf323:/rsm_protocol.h diff --git a/rsm_protocol.h b/rsm_protocol.h index 6b508d8..53908f3 100644 --- a/rsm_protocol.h +++ b/rsm_protocol.h @@ -1,6 +1,7 @@ #ifndef rsm_protocol_h #define rsm_protocol_h +#include "types.h" #include "rpc/rpc.h" class rsm_client_protocol { @@ -23,33 +24,21 @@ class rsm_protocol { public: enum status : status_t { OK, ERR, BUSY}; enum rpc_numbers : proc_t { - invoke = 0x10001, + invoke = 0xa001, transferreq, transferdonereq, joinreq, }; struct transferres { - std::string state; + string state; viewstamp last; }; - - struct joinres { - std::string log; - }; }; -inline bool operator==(viewstamp a, viewstamp b) { - return a.vid == b.vid && a.seqno == b.seqno; -} - -inline bool operator>(viewstamp a, viewstamp b) { - return (a.vid > b.vid) || ((a.vid == b.vid) && a.seqno > b.seqno); -} - -inline bool operator!=(viewstamp a, viewstamp b) { - return a.vid != b.vid || a.seqno != b.seqno; -} +inline bool operator==(viewstamp a, viewstamp b) { return tie(a.vid, a.seqno) == tie(b.vid, b.seqno); } +inline bool operator>(viewstamp a, viewstamp b) { return tie(a.vid, a.seqno) > tie(b.vid, b.seqno); } +inline bool operator!=(viewstamp a, viewstamp b) { return tie(a.vid, a.seqno) != tie(b.vid, b.seqno); } inline marshall& operator<<(marshall &m, viewstamp v) { return m << v.vid << v.seqno; @@ -67,14 +56,6 @@ inline unmarshall & operator>>(unmarshall &u, rsm_protocol::transferres &r) { return u >> r.state >> r.last; } -inline marshall & operator<<(marshall &m, rsm_protocol::joinres r) { - return m << r.log; -} - -inline unmarshall & operator>>(unmarshall &u, rsm_protocol::joinres &r) { - return u >> r.log; -} - class rsm_test_protocol { public: enum status : status_t {OK, ERR};