#define LOCK_PREFIX "lock."
typedef struct lock_info_s {
- map<cls_lock_id_t, cls_lock_locker_info_t> lockers;
- ClsLockType lock_type;
- string tag;
+ map<cls_lock_id_t, cls_lock_locker_info_t> lockers; // map of lockers
+ ClsLockType lock_type; // lock type (exclusive / shared)
+ string tag; // tag: operations on lock can only succeed with this tag
+ // as long as set of non expired lockers
+ // is bigger than 0.
void encode(bufferlist &bl) const {
ENCODE_START(1, 1, bl);
}
}
+/*
+ * cls_lock_id_t: the locker id, needs to be unique in a single lock
+ */
struct cls_lock_id_t {
- entity_name_t locker;
- string cookie;
+ entity_name_t locker; // locker's client name
+ string cookie; // locker's cookie.
cls_lock_id_t() {}
cls_lock_id_t(entity_name_t& _n, const string& _c) : locker(_n), cookie(_c) {}
struct cls_lock_locker_info_t
{
- utime_t expiration;
- entity_addr_t addr;
- string description;
+ utime_t expiration; // expiration: non-zero means epoch of locker expiration
+ entity_addr_t addr; // addr: locker address
+ string description; // description: locker description, may be empty
cls_lock_locker_info_t() {}
cls_lock_locker_info_t(const utime_t& _e, const entity_addr_t& _a,