namespace lock {
void lock(ObjectWriteOperation& rados_op,
- string& name, ClsLockType type,
- string& cookie, string& tag,
- string description,
- utime_t& duration, uint8_t flags)
+ const string& name, ClsLockType type,
+ const string& cookie, const string& tag,
+ const string& description,
+ const utime_t& duration, uint8_t flags)
{
cls_lock_lock_op op;
op.name = name;
}
int lock(IoCtx& ioctx,
- string& oid,
- string& name, ClsLockType type,
- string& cookie, string& tag,
- string description, utime_t& duration, uint8_t flags)
+ const string& oid,
+ const string& name, ClsLockType type,
+ const string& cookie, const string& tag,
+ const string& description, const utime_t& duration,
+ uint8_t flags)
{
ObjectWriteOperation op;
lock(op, name, type, cookie, tag, description, duration, flags);
}
void unlock(ObjectWriteOperation& rados_op,
- string& name, string& cookie)
+ const string& name, const string& cookie)
{
cls_lock_unlock_op op;
op.name = name;
rados_op.exec("lock", "unlock", in);
}
- int unlock(IoCtx& ioctx, string& oid,
- string& name, string& cookie)
+ int unlock(IoCtx& ioctx, const string& oid,
+ const string& name, const string& cookie)
{
ObjectWriteOperation op;
unlock(op, name, cookie);
}
void break_lock(ObjectWriteOperation& rados_op,
- string& name, string& cookie,
- entity_name_t& locker)
+ const string& name, const string& cookie,
+ const entity_name_t& locker)
{
cls_lock_break_op op;
op.name = name;
rados_op.exec("lock", "break_lock", in);
}
- int break_lock(IoCtx& ioctx, string& oid,
- string& name, string& cookie,
- entity_name_t& locker)
+ int break_lock(IoCtx& ioctx, const string& oid,
+ const string& name, const string& cookie,
+ const entity_name_t& locker)
{
ObjectWriteOperation op;
break_lock(op, name, cookie, locker);
return ioctx.operate(oid, &op);
}
- int list_locks(IoCtx& ioctx, string& oid, list<string> *locks)
+ int list_locks(IoCtx& ioctx, const string& oid, list<string> *locks)
{
bufferlist in, out;
int r = ioctx.exec(oid, "lock", "list_locks", in, out);
return 0;
}
- int get_lock_info(IoCtx& ioctx, string& oid, string& lock,
+ int get_lock_info(IoCtx& ioctx, const string& oid, const string& lock,
map<locker_id_t, locker_info_t> *lockers,
ClsLockType *lock_type,
string *tag)
cookie, tag, description, duration, flags);
}
- int Lock::lock_shared(IoCtx& ioctx, string& oid)
+ int Lock::lock_shared(IoCtx& ioctx, const string& oid)
{
return lock(ioctx, oid, name, LOCK_SHARED,
cookie, tag, description, duration, flags);
cookie, tag, description, duration, flags);
}
- int Lock::lock_exclusive(IoCtx& ioctx, string& oid)
+ int Lock::lock_exclusive(IoCtx& ioctx, const string& oid)
{
return lock(ioctx, oid, name, LOCK_EXCLUSIVE,
cookie, tag, description, duration, flags);
rados::cls::lock::unlock(op, name, cookie);
}
- int Lock::unlock(IoCtx& ioctx, string& oid)
+ int Lock::unlock(IoCtx& ioctx, const string& oid)
{
return rados::cls::lock::unlock(ioctx, oid, name, cookie);
}
- void Lock::break_lock(ObjectWriteOperation& op, entity_name_t& locker)
+ void Lock::break_lock(ObjectWriteOperation& op, const entity_name_t& locker)
{
rados::cls::lock::break_lock(op, name, cookie, locker);
}
- int Lock::break_lock(IoCtx& ioctx, string& oid, entity_name_t& locker)
+ int Lock::break_lock(IoCtx& ioctx, const string& oid, const entity_name_t& locker)
{
return rados::cls::lock::break_lock(ioctx, oid, name, cookie, locker);
}
namespace lock {
extern void lock(librados::ObjectWriteOperation& rados_op,
- std::string& name, ClsLockType type,
- std::string& cookie, std::string& tag,
- std::string description, utime_t& duration, uint8_t flags);
+ const std::string& name, ClsLockType type,
+ const std::string& cookie, const std::string& tag,
+ const std::string& description, const utime_t& duration,
+ uint8_t flags);
extern int lock(librados::IoCtx& ioctx,
- std::string& oid,
- std::string& name, ClsLockType type,
- std::string& cookie, std::string& tag,
- std::string description, utime_t& duration, uint8_t flags);
+ const std::string& oid,
+ const std::string& name, ClsLockType type,
+ const std::string& cookie, const std::string& tag,
+ const std::string& description, const utime_t& duration,
+ uint8_t flags);
extern void unlock(librados::ObjectWriteOperation& rados_op,
- std::string& name, std::string& cookie);
+ const std::string& name, const std::string& cookie);
- extern int unlock(librados::IoCtx& ioctx, std::string& oid,
- std::string& name, std::string& cookie);
+ extern int unlock(librados::IoCtx& ioctx, const std::string& oid,
+ const std::string& name, const std::string& cookie);
extern void break_lock(librados::ObjectWriteOperation& op,
- std::string& name, std::string& cookie,
- entity_name_t& locker);
-
- extern int break_lock(librados::IoCtx& ioctx, std::string& oid,
- std::string& name, std::string& cookie,
- entity_name_t& locker);
-
- extern int list_locks(librados::IoCtx& ioctx, std::string& oid, list<std::string> *locks);
- extern int get_lock_info(librados::IoCtx& ioctx, std::string& oid, std::string& lock,
- map<locker_id_t, locker_info_t> *lockers,
+ const std::string& name, const std::string& cookie,
+ const entity_name_t& locker);
+
+ extern int break_lock(librados::IoCtx& ioctx, const std::string& oid,
+ const std::string& name, const std::string& cookie,
+ const entity_name_t& locker);
+
+ extern int list_locks(librados::IoCtx& ioctx, const std::string& oid,
+ list<std::string> *locks);
+ extern int get_lock_info(librados::IoCtx& ioctx, const std::string& oid,
+ const std::string& lock,
+ map<locker_id_t, locker_info_t> *lockers,
ClsLockType *lock_type,
std::string *tag);
void lock_exclusive(librados::ObjectWriteOperation& ioctx);
void lock_shared(librados::ObjectWriteOperation& ioctx);
void unlock(librados::ObjectWriteOperation& ioctx);
- void break_lock(librados::ObjectWriteOperation& ioctx, entity_name_t& locker);
+ void break_lock(librados::ObjectWriteOperation& ioctx, const entity_name_t& locker);
/* IoCtx*/
- int lock_exclusive(librados::IoCtx& ioctx, std::string& oid);
- int lock_shared(librados::IoCtx& ioctx, std::string& oid);
- int unlock(librados::IoCtx& ioctx, std::string& oid);
- int break_lock(librados::IoCtx& ioctx, std::string& oid, entity_name_t& locker);
+ int lock_exclusive(librados::IoCtx& ioctx, const std::string& oid);
+ int lock_shared(librados::IoCtx& ioctx, const std::string& oid);
+ int unlock(librados::IoCtx& ioctx, const std::string& oid);
+ int break_lock(librados::IoCtx& ioctx, const std::string& oid,
+ const entity_name_t& locker);
};
} // namespace lock