switch (op->op) {
case Transaction::OP_NOP:
break;
+ case Transaction::OP_REMOVE:
+ {
+ coll_t cid = i.get_cid(op->cid);
+ ghobject_t oid = i.get_oid(op->oid);
+ r = _remove(cid, oid);
+ }
case Transaction::OP_TOUCH:
{
coll_t cid = i.get_cid(op->cid);
return seastar::now();
}
+int CyanStore::_remove(const coll_t& cid, const ghobject_t& oid)
+{
+ logger().debug("{} cid={} oid={}",
+ __func__, cid, oid);
+ auto c = open_collection(cid);
+ if (!c)
+ return -ENOENT;
+
+ auto i = c->object_hash.find(oid);
+ if (i == c->object_hash.end())
+ return -ENOENT;
+ used_bytes -= i->second->get_size();
+ c->object_hash.erase(i);
+ c->object_map.erase(oid);
+ return 0;
+}
+
int CyanStore::_touch(const coll_t& cid, const ghobject_t& oid)
{
logger().debug("{} cid={} oid={}",
uuid_d get_fsid() const;
private:
+ int _remove(const coll_t& cid, const ghobject_t& oid);
int _touch(const coll_t& cid, const ghobject_t& oid);
int _write(const coll_t& cid, const ghobject_t& oid,
uint64_t offset, size_t len, const bufferlist& bl,
osd_op.outdata = std::move(bl);
return seastar::now();
});
+ case CEPH_OSD_OP_DELETE:
+ return backend->remove(os, txn);
default:
throw std::runtime_error(
fmt::format("op '{}' not supported", ceph_osd_op_name(op.op)));
return seastar::now();
}
+seastar::future<> PGBackend::remove(ObjectState& os,
+ ceph::os::Transaction& txn)
+{
+ // todo: snapset
+ txn.remove(coll->cid, ghobject_t{os.oi.soid, ghobject_t::NO_GEN, shard});
+ os.oi.size = 0;
+ os.oi.new_object();
+ // todo: update watchers
+ if (os.oi.is_whiteout()) {
+ os.oi.clear_flag(object_info_t::FLAG_WHITEOUT);
+ }
+ return seastar::now();
+}
+
seastar::future<std::vector<hobject_t>, hobject_t>
PGBackend::list_objects(const hobject_t& start, uint64_t limit)
{
size_t truncate_size,
uint32_t truncate_seq,
uint32_t flags);
+ seastar::future<> remove(
+ ObjectState& os,
+ ceph::os::Transaction& txn);
seastar::future<> writefull(
ObjectState& os,
const OSDOp& osd_op,