inline constexpr std::string_view all_nspaces("\001");
-enum class cmpxattr_op : std::uint8_t {
+enum class cmp_op : std::uint8_t {
eq = 1,
ne = 2,
gt = 3,
void cmpext(uint64_t off, ceph::buffer::list&& cmp_bl,
int* unmatch = nullptr);
- void cmpxattr(std::string_view name, cmpxattr_op op,
+ void cmpxattr(std::string_view name, cmp_op op,
const ceph::buffer::list& val);
- void cmpxattr(std::string_view name, cmpxattr_op op, std::uint64_t val);
+ void cmpxattr(std::string_view name, cmp_op op, std::uint64_t val);
void assert_version(uint64_t ver);
void assert_exists();
void cmp_omap(const boost::container::flat_map<std::string,
std::pair<ceph::buffer::list,
- int>>& assertions);
+ cmp_op>>& assertions);
void exec(std::string_view cls, std::string_view method,
const ceph::buffer::list& inbl,
return std::move(*this);
}
- ReadOp& cmpxattr(std::string_view name, cmpxattr_op op,
+ ReadOp& cmpxattr(std::string_view name, cmp_op op,
const ceph::buffer::list& val) & {
Op::cmpxattr(name, op, val);
return *this;
}
- ReadOp&& cmpxattr(std::string_view name, cmpxattr_op op,
+ ReadOp&& cmpxattr(std::string_view name, cmp_op op,
const ceph::buffer::list& val) && {
Op::cmpxattr(name, op, val);
return std::move(*this);
}
- ReadOp& cmpxattr(std::string_view name, cmpxattr_op op, std::uint64_t val) & {
+ ReadOp& cmpxattr(std::string_view name, cmp_op op, std::uint64_t val) & {
Op::cmpxattr(name, op, val);
return *this;
}
- ReadOp&& cmpxattr(std::string_view name, cmpxattr_op op, std::uint64_t val) && {
+ ReadOp&& cmpxattr(std::string_view name, cmp_op op, std::uint64_t val) && {
Op::cmpxattr(name, op, val);
return std::move(*this);
}
ReadOp& cmp_omap(
const boost::container::flat_map<
- std::string, std::pair<ceph::buffer::list, int>>& assertions) & {
+ std::string, std::pair<ceph::buffer::list, cmp_op>>& assertions) & {
Op::cmp_omap(assertions);
return *this;
}
ReadOp&& cmp_omap(
const boost::container::flat_map<
- std::string, std::pair<ceph::buffer::list, int>>& assertions) && {
+ std::string, std::pair<ceph::buffer::list, cmp_op>>& assertions) && {
Op::cmp_omap(assertions);
return std::move(*this);
}
return std::move(*this);
}
- WriteOp& cmpxattr(std::string_view name, cmpxattr_op op,
+ WriteOp& cmpxattr(std::string_view name, cmp_op op,
const ceph::buffer::list& val) & {
Op::cmpxattr(name, op, val);
return *this;
}
- WriteOp&& cmpxattr(std::string_view name, cmpxattr_op op,
+ WriteOp&& cmpxattr(std::string_view name, cmp_op op,
const ceph::buffer::list& val) && {
Op::cmpxattr(name, op, val);
return std::move(*this);
}
- WriteOp& cmpxattr(std::string_view name, cmpxattr_op op, std::uint64_t val) & {
+ WriteOp& cmpxattr(std::string_view name, cmp_op op, std::uint64_t val) & {
Op::cmpxattr(name, op, val);
return *this;
}
- WriteOp&& cmpxattr(std::string_view name, cmpxattr_op op, std::uint64_t val) && {
+ WriteOp&& cmpxattr(std::string_view name, cmp_op op, std::uint64_t val) && {
Op::cmpxattr(name, op, val);
return std::move(*this);
}
WriteOp& cmp_omap(
const boost::container::flat_map<
- std::string, std::pair<ceph::buffer::list, int>>& assertions) & {
+ std::string, std::pair<ceph::buffer::list, cmp_op>>& assertions) & {
Op::cmp_omap(assertions);
return *this;
}
WriteOp&& cmp_omap(
const boost::container::flat_map<
- std::string, std::pair<ceph::buffer::list, int>>& assertions) && {
+ std::string, std::pair<ceph::buffer::list, cmp_op>>& assertions) && {
Op::cmp_omap(assertions);
return std::move(*this);
}
reinterpret_cast<OpImpl*>(&impl)->op.cmpext(off, std::move(cmp_bl), nullptr,
s);
}
-void Op::cmpxattr(std::string_view name, cmpxattr_op op, const bufferlist& val) {
+void Op::cmpxattr(std::string_view name, cmp_op op, const bufferlist& val) {
reinterpret_cast<OpImpl*>(&impl)->
op.cmpxattr(name, std::uint8_t(op), CEPH_OSD_CMPXATTR_MODE_STRING, val);
}
-void Op::cmpxattr(std::string_view name, cmpxattr_op op, std::uint64_t val) {
+void Op::cmpxattr(std::string_view name, cmp_op op, std::uint64_t val) {
bufferlist bl;
encode(val, bl);
reinterpret_cast<OpImpl*>(&impl)->
}
void Op::cmp_omap(const bc::flat_map<
std::string, std::pair<cb::list,
- int>>& assertions) {
- reinterpret_cast<OpImpl*>(&impl)->op.omap_cmp(assertions, nullptr);
+ cmp_op>>& assertions) {
+ buffer::list bl;
+ encode(uint32_t(assertions.size()), bl);
+ for (const auto& [key, assertion] : assertions) {
+ const auto& [value, op] = assertion;
+ encode(key, bl);
+ encode(value, bl);
+ encode(int(op), bl);
+ }
+ reinterpret_cast<OpImpl*>(&impl)->op.omap_cmp(std::move(bl), nullptr);
}
void Op::exec(std::string_view cls, std::string_view method,