5 #include "lock_protocol.h"
9 typedef std::pair<callback_t, lock_protocol::xid_t> holder_t;
14 lock_state(const lock_state & other);
17 std::list<holder_t> wanted_by;
18 std::map<callback_t, lock_protocol::xid_t> old_requests;
20 lock_state & operator=(const lock_state &);
22 MEMBERS(held, held_by, wanted_by)
25 typedef std::map<lock_protocol::lockid_t, lock_state> lock_map;
27 class lock_server : private rsm_state_transfer {
30 std::mutex lock_table_lock;
32 lock_state & get_lock_state(lock_protocol::lockid_t lid);
33 fifo<lock_protocol::lockid_t> retry_fifo;
34 fifo<lock_protocol::lockid_t> revoke_fifo;
36 string marshal_state();
37 void unmarshal_state(const string & state);
38 void revoker NORETURN ();
39 void retryer NORETURN ();
42 lock_protocol::status acquire(int &, lock_protocol::lockid_t, const callback_t & id, lock_protocol::xid_t);
43 lock_protocol::status release(int &, lock_protocol::lockid_t, const callback_t & id, lock_protocol::xid_t);
44 lock_protocol::status stat(int &, lock_protocol::lockid_t, const callback_t & id);