More clean-ups
[invirt/third/libt4.git] / lock_protocol.h
1 // lock protocol
2
3 #ifndef lock_protocol_h
4 #define lock_protocol_h
5
6 #include "types.h"
7 #include "rpc/rpc.h"
8
9 typedef string callback_t;
10
11 namespace lock_protocol {
12     enum status : rpc_protocol::status { OK, RETRY, RPCERR, NOENT, IOERR };
13     using lockid_t = string;
14     using xid_t = uint64_t;
15     REMOTE_PROCEDURE_BASE(0x7000);
16     REMOTE_PROCEDURE(1, acquire, (int &, lockid_t, callback_t, xid_t));
17     REMOTE_PROCEDURE(2, release, (int &, lockid_t, callback_t, xid_t));
18     REMOTE_PROCEDURE(3, stat, (int &, lockid_t, callback_t));
19 };
20
21 namespace rlock_protocol {
22     using lockid_t = lock_protocol::lockid_t;
23     using xid_t = lock_protocol::xid_t;
24     enum status : rpc_protocol::status { OK, RPCERR };
25     REMOTE_PROCEDURE_BASE(0x8000);
26     REMOTE_PROCEDURE(1, revoke, (int &, lockid_t, xid_t));
27     REMOTE_PROCEDURE(2, retry, (int &, lockid_t, xid_t));
28 };
29 #endif