mirror of
https://github.com/ceph/ceph
synced 2025-01-01 08:32:24 +00:00
crimson/osd: bring the skeleton of SnapTrimEvent
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
This commit is contained in:
parent
ba60d84e7b
commit
806aa25960
@ -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
|
||||
|
@ -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:
|
||||
|
36
src/crimson/osd/osd_operations/snaptrim_event.cc
Normal file
36
src/crimson/osd/osd_operations/snaptrim_event.cc
Normal 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
|
49
src/crimson/osd/osd_operations/snaptrim_event.h
Normal file
49
src/crimson/osd/osd_operations/snaptrim_event.h
Normal 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
|
Loading…
Reference in New Issue
Block a user