#include <memory>
#include <string>
#include <boost/smart_ptr/local_shared_ptr.hpp>
+#include <boost/container/flat_set.hpp>
#include "crimson/os/futurized_store.h"
#include "crimson/os/futurized_collection.h"
#include "crimson/osd/acked_peers.h"
+#include "crimson/osd/pg.h"
#include "crimson/common/shared_lru.h"
+#include "messages/MOSDOp.h"
+#include "messages/MOSDOpReply.h"
+#include "os/Transaction.h"
#include "osd/osd_types.h"
#include "crimson/osd/object_context.h"
+#include "crimson/osd/osd_operation.h"
+#include "crimson/osd/osd_operations/osdop_params.h"
struct hobject_t;
-class MOSDRepOpReply;
namespace ceph::os {
class Transaction;
using ll_read_errorator = crimson::os::FuturizedStore::read_errorator;
public:
+ using load_metadata_ertr = crimson::errorator<
+ crimson::ct_error::object_corrupted>;
PGBackend(shard_id_t shard, CollectionRef coll, crimson::os::FuturizedStore* store);
virtual ~PGBackend() = default;
static std::unique_ptr<PGBackend> create(pg_t pgid,
crimson::os::CollectionRef coll,
crimson::osd::ShardServices& shard_services,
const ec_profile_t& ec_profile);
-
+ using attrs_t =
+ std::map<std::string, ceph::bufferptr, std::less<>>;
using read_errorator = ll_read_errorator::extend<
crimson::ct_error::object_corrupted>;
- read_errorator::future<ceph::bufferlist> read(
- const object_info_t& oi,
- uint64_t off,
- uint64_t len,
- size_t truncate_size,
- uint32_t truncate_seq,
- uint32_t flags);
-
+ read_errorator::future<> read(
+ const ObjectState& os,
+ OSDOp& osd_op);
+ read_errorator::future<> sparse_read(
+ const ObjectState& os,
+ OSDOp& osd_op);
+ using checksum_errorator = ll_read_errorator::extend<
+ crimson::ct_error::object_corrupted,
+ crimson::ct_error::invarg>;
+ checksum_errorator::future<> checksum(
+ const ObjectState& os,
+ OSDOp& osd_op);
+ using cmp_ext_errorator = ll_read_errorator::extend<
+ crimson::ct_error::invarg>;
+ cmp_ext_errorator::future<> cmp_ext(
+ const ObjectState& os,
+ OSDOp& osd_op);
using stat_errorator = crimson::errorator<crimson::ct_error::enoent>;
stat_errorator::future<> stat(
const ObjectState& os,
OSDOp& osd_op);
+ // TODO: switch the entire write family to errorator.
+ using write_ertr = crimson::errorator<
+ crimson::ct_error::file_too_large>;
seastar::future<> create(
ObjectState& os,
const OSDOp& osd_op,
seastar::future<> write(
ObjectState& os,
const OSDOp& osd_op,
- ceph::os::Transaction& trans);
+ ceph::os::Transaction& trans,
+ osd_op_params_t& osd_op_params);
+ seastar::future<> write_same(
+ ObjectState& os,
+ const OSDOp& osd_op,
+ ceph::os::Transaction& trans,
+ osd_op_params_t& osd_op_params);
seastar::future<> writefull(
ObjectState& os,
const OSDOp& osd_op,
- ceph::os::Transaction& trans);
+ ceph::os::Transaction& trans,
+ osd_op_params_t& osd_op_params);
+ using append_errorator = crimson::errorator<
+ crimson::ct_error::invarg>;
+ append_errorator::future<> append(
+ ObjectState& os,
+ OSDOp& osd_op,
+ ceph::os::Transaction& trans,
+ osd_op_params_t& osd_op_params);
+ write_ertr::future<> truncate(
+ ObjectState& os,
+ const OSDOp& osd_op,
+ ceph::os::Transaction& trans,
+ osd_op_params_t& osd_op_params);
+ write_ertr::future<> zero(
+ ObjectState& os,
+ const OSDOp& osd_op,
+ ceph::os::Transaction& trans,
+ osd_op_params_t& osd_op_params);
seastar::future<crimson::osd::acked_peers_t> mutate_object(
std::set<pg_shard_t> pg_shards,
crimson::osd::ObjectContextRef &&obc,
ceph::os::Transaction&& txn,
- const MOSDOp& m,
+ const osd_op_params_t& osd_op_p,
epoch_t min_epoch,
epoch_t map_epoch,
- eversion_t ver);
- seastar::future<std::vector<hobject_t>, hobject_t> list_objects(
+ std::vector<pg_log_entry_t>&& log_entries);
+ seastar::future<std::tuple<std::vector<hobject_t>, hobject_t>> list_objects(
const hobject_t& start,
uint64_t limit) const;
seastar::future<> setxattr(
get_attr_errorator::future<ceph::bufferptr> getxattr(
const hobject_t& soid,
std::string_view key) const;
+ get_attr_errorator::future<> get_xattrs(
+ const ObjectState& os,
+ OSDOp& osd_op) const;
+ using rm_xattr_ertr = crimson::errorator<crimson::ct_error::enoent>;
+ rm_xattr_ertr::future<> rm_xattr(
+ ObjectState& os,
+ const OSDOp& osd_op,
+ ceph::os::Transaction& trans);
+ seastar::future<struct stat> stat(
+ CollectionRef c,
+ const ghobject_t& oid) const;
+ seastar::future<std::map<uint64_t, uint64_t>> fiemap(
+ CollectionRef c,
+ const ghobject_t& oid,
+ uint64_t off,
+ uint64_t len);
// OMAP
- seastar::future<> omap_get_keys(
+ ll_read_errorator::future<> omap_get_keys(
const ObjectState& os,
OSDOp& osd_op) const;
- seastar::future<> omap_get_vals(
+ ll_read_errorator::future<> omap_get_vals(
const ObjectState& os,
OSDOp& osd_op) const;
- seastar::future<> omap_get_vals_by_keys(
+ ll_read_errorator::future<> omap_get_vals_by_keys(
const ObjectState& os,
OSDOp& osd_op) const;
seastar::future<> omap_set_vals(
+ ObjectState& os,
+ const OSDOp& osd_op,
+ ceph::os::Transaction& trans,
+ osd_op_params_t& osd_op_params);
+ ll_read_errorator::future<ceph::bufferlist> omap_get_header(
+ const crimson::os::CollectionRef& c,
+ const ghobject_t& oid) const;
+ ll_read_errorator::future<> omap_get_header(
+ const ObjectState& os,
+ OSDOp& osd_op) const;
+ seastar::future<> omap_set_header(
ObjectState& os,
const OSDOp& osd_op,
ceph::os::Transaction& trans);
+ seastar::future<> omap_remove_range(
+ ObjectState& os,
+ const OSDOp& osd_op,
+ ceph::os::Transaction& trans);
+ using omap_clear_ertr = crimson::errorator<crimson::ct_error::enoent>;
+ omap_clear_ertr::future<> omap_clear(
+ ObjectState& os,
+ OSDOp& osd_op,
+ ceph::os::Transaction& trans,
+ osd_op_params_t& osd_op_params);
virtual void got_rep_op_reply(const MOSDRepOpReply&) {}
-
+ virtual seastar::future<> stop() = 0;
+ struct peering_info_t {
+ bool is_primary;
+ };
+ virtual void on_actingset_changed(peering_info_t pi) = 0;
+ virtual void on_activate_complete();
protected:
const shard_id_t shard;
CollectionRef coll;
crimson::os::FuturizedStore* store;
-
+ bool stopping = false;
+ std::optional<peering_info_t> peering;
public:
- using load_metadata_ertr = crimson::errorator<
- crimson::ct_error::object_corrupted>;
struct loaded_object_md_t {
ObjectState os;
std::optional<SnapSet> ss;
_submit_transaction(std::set<pg_shard_t>&& pg_shards,
const hobject_t& hoid,
ceph::os::Transaction&& txn,
- osd_reqid_t req_id,
+ const osd_op_params_t& osd_op_p,
epoch_t min_epoch, epoch_t max_epoch,
- eversion_t ver) = 0;
+ std::vector<pg_log_entry_t>&& log_entries) = 0;
+ friend class ReplicatedRecoveryBackend;
};