crimson/osd: bring the skeleton of SnapTrimEvent

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
This commit is contained in:
Radoslaw Zarzynski 2022-10-26 18:46:37 +00:00
parent ba60d84e7b
commit 806aa25960
4 changed files with 88 additions and 0 deletions

View File

@ -26,6 +26,7 @@ add_executable(crimson-osd
osd_operations/logmissing_request_reply.cc
osd_operations/background_recovery.cc
osd_operations/recovery_subrequest.cc
osd_operations/snaptrim_event.cc
pg_recovery.cc
recovery_backend.cc
replicated_recovery_backend.cc

View File

@ -46,6 +46,7 @@ enum class OperationTypeCode {
historic_client_request,
logmissing_request,
logmissing_request_reply,
snaptrim_event,
last_op
};
@ -62,6 +63,7 @@ static constexpr const char* const OP_NAMES[] = {
"historic_client_request",
"logmissing_request",
"logmissing_request_reply",
"snaptrim_event",
};
// prevent the addition of OperationTypeCode-s with no matching OP_NAMES entry:

View File

@ -0,0 +1,36 @@
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#include "crimson/osd/osd_operations/snaptrim_event.h"
#include "crimson/osd/pg.h"
namespace {
seastar::logger& logger() {
return crimson::get_logger(ceph_subsys_osd);
}
}
namespace crimson::osd {
void SnapTrimEvent::print(std::ostream &lhs) const
{
lhs << "SnapTrimEvent("
<< "pgid=" << pg->get_pgid()
<< " snapid=" << snapid
<< ")";
}
void SnapTrimEvent::dump_detail(Formatter *f) const
{
f->open_object_section("SnapTrimEvent");
f->dump_stream("pgid") << pg->get_pgid();
f->close_section();
}
seastar::future<> SnapTrimEvent::start()
{
logger().debug("{}", __func__);
return seastar::now();
}
} // namespace crimson::osd

View File

@ -0,0 +1,49 @@
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#pragma once
#include <iostream>
#include <seastar/core/future.hh>
#include "crimson/osd/osdmap_gate.h"
#include "crimson/osd/osd_operation.h"
#include "crimson/osd/osd_operations/background_recovery.h"
#include "osd/osd_types.h"
#include "osd/PGPeeringEvent.h"
#include "osd/PeeringState.h"
namespace ceph {
class Formatter;
}
namespace crimson::osd {
class OSD;
class ShardServices;
class PG;
class SnapTrimEvent final : public PhasedOperationT<SnapTrimEvent> {
public:
static constexpr OperationTypeCode type = OperationTypeCode::snaptrim_event;
SnapTrimEvent(Ref<PG> pg, snapid_t snapid)
: pg(std::move(pg)),
snapid(snapid) {}
void print(std::ostream &) const final;
void dump_detail(ceph::Formatter* f) const final;
seastar::future<> start();
seastar::future<> with_pg(
ShardServices &shard_services, Ref<PG> pg);
private:
Ref<PG> pg;
const snapid_t snapid;
};
} // namespace crimson::osd
#if FMT_VERSION >= 90000
template <> struct fmt::formatter<crimson::osd::SnapTrimEvent> : fmt::ostream_formatter {};
#endif