};
template <>
-struct EventBackendRegistry<osd::PeeringEvent> {
+struct EventBackendRegistry<osd::RemotePeeringEvent> {
+ static std::tuple<> get_backends() {
+ return {/* no extenral backends */};
+ }
+};
+
+template <>
+struct EventBackendRegistry<osd::LocalPeeringEvent> {
static std::tuple<> get_backends() {
return {/* no extenral backends */};
}
static constexpr auto type_name = "BackfillRecovery::PGPipeline::process";
} process;
friend class BackfillRecovery;
+ template <class T>
friend class PeeringEvent;
+ friend class LocalPeeringEvent;
+ friend class RemotePeeringEvent;
};
template <class EventT>
namespace crimson::osd {
-void PeeringEvent::print(std::ostream &lhs) const
+template <class T>
+void PeeringEvent<T>::print(std::ostream &lhs) const
{
lhs << "PeeringEvent("
<< "from=" << from
<< ")";
}
-void PeeringEvent::dump_detail(Formatter *f) const
+template <class T>
+void PeeringEvent<T>::dump_detail(Formatter *f) const
{
f->open_object_section("PeeringEvent");
f->dump_stream("from") << from;
}
-PeeringEvent::PGPipeline &PeeringEvent::pp(PG &pg)
+template <class T>
+PGPeeringPipeline &PeeringEvent<T>::pp(PG &pg)
{
return pg.peering_request_pg_pipeline;
}
-seastar::future<> PeeringEvent::start()
+template <class T>
+seastar::future<> PeeringEvent<T>::start()
{
-
logger().debug("{}: start", *this);
- IRef ref = this;
+ typename T::IRef ref = static_cast<T*>(this);
auto maybe_delay = seastar::now();
if (delay) {
maybe_delay = seastar::sleep(
handle.exit();
return complete_rctx_no_pg();
}
+ using interruptor = typename T::interruptor;
return interruptor::with_interruption([this, pg] {
logger().debug("{}: pg present", *this);
- return enter_stage<interruptor>(
+ return this->template enter_stage<interruptor>(
pp(*pg).await_map
).then_interruptible([this, pg] {
- return with_blocking_event<PG_OSDMapGate::OSDMapBlocker::BlockingEvent>(
+ return this->template with_blocking_event<PG_OSDMapGate::OSDMapBlocker::BlockingEvent>(
[this, pg] (auto&& trigger) {
return pg->osdmap_gate.wait_for_map(std::move(trigger),
evt.get_epoch_sent());
});
}).then_interruptible([this, pg](auto) {
- return enter_stage<interruptor>(pp(*pg).process);
+ return this->template enter_stage<interruptor>(pp(*pg).process);
}).then_interruptible([this, pg] {
// TODO: likely we should synchronize also with the pg log-based
// recovery.
- return enter_stage<interruptor>(BackfillRecovery::bp(*pg).process);
+ return this->template enter_stage<interruptor>(BackfillRecovery::bp(*pg).process);
}).then_interruptible([this, pg] {
pg->do_peering_event(evt, ctx);
handle.exit();
return complete_rctx(pg);
- }).then_interruptible([this, pg] () -> PeeringEvent::interruptible_future<> {
+ }).then_interruptible([this, pg] () -> typename T::template interruptible_future<> {
if (!pg->get_need_up_thru()) {
return seastar::now();
}
});
}
-void PeeringEvent::on_pg_absent()
+template <class T>
+void PeeringEvent<T>::on_pg_absent()
{
logger().debug("{}: pg absent, dropping", *this);
}
-PeeringEvent::interruptible_future<> PeeringEvent::complete_rctx(Ref<PG> pg)
+template <class T>
+typename PeeringEvent<T>::template interruptible_future<>
+PeeringEvent<T>::complete_rctx(Ref<PG> pg)
{
logger().debug("{}: submitting ctx", *this);
return shard_services.dispatch_context(
}
}
-PeeringEvent::interruptible_future<> RemotePeeringEvent::complete_rctx(Ref<PG> pg)
+RemotePeeringEvent::interruptible_future<> RemotePeeringEvent::complete_rctx(Ref<PG> pg)
{
if (pg) {
return PeeringEvent::complete_rctx(pg);
seastar::future<Ref<PG>> RemotePeeringEvent::get_pg()
{
-#if 0
return enter_stage<>(op().await_active).then([this] {
return osd.state.when_active();
}).then([this] {
return enter_stage<>(cp().await_map);
}).then([this] {
- return with_blocking_future(
- osd.osdmap_gate.wait_for_map(evt.get_epoch_sent()));
+ using OSDMapBlockingEvent =
+ OSD_OSDMapGate::OSDMapBlocker::BlockingEvent;
+ return with_blocking_event<OSDMapBlockingEvent>(
+ [this] (auto&& trigger) {
+ return osd.osdmap_gate.wait_for_map(std::move(trigger),
+ evt.get_epoch_sent());
+ });
}).then([this](auto epoch) {
logger().debug("{}: got map {}", *this, epoch);
- return with_blocking_future(handle.enter(cp().get_pg));
+ return enter_stage<>(cp().get_pg);
}).then([this] {
- return with_blocking_future(
- osd.get_or_create_pg(
- pgid, evt.get_epoch_sent(), std::move(evt.create_info)));
+ return with_blocking_event<PGMap::PGCreationBlockingEvent>(
+ [this] (auto&& trigger) {
+ return osd.get_or_create_pg(std::move(trigger),
+ pgid,
+ evt.get_epoch_sent(),
+ std::move(evt.create_info));
+ });
});
-#else
- return seastar::make_ready_future<Ref<PG>>(nullptr);
-#endif
}
seastar::future<Ref<PG>> LocalPeeringEvent::get_pg() {
LocalPeeringEvent::~LocalPeeringEvent() {}
+template class PeeringEvent<RemotePeeringEvent>;
+template class PeeringEvent<LocalPeeringEvent>;
+
}
class ShardServices;
class PG;
-class PeeringEvent : public PhasedOperationT<PeeringEvent> {
-public:
- static constexpr OperationTypeCode type = OperationTypeCode::peering_event;
-
- class PGPipeline {
+ class PGPeeringPipeline {
struct AwaitMap : OrderedExclusivePhaseT<AwaitMap> {
static constexpr auto type_name = "PeeringEvent::PGPipeline::await_map";
} await_map;
struct Process : OrderedExclusivePhaseT<Process> {
static constexpr auto type_name = "PeeringEvent::PGPipeline::process";
} process;
+ template <class T>
friend class PeeringEvent;
+ friend class LocalPeeringEvent;
+ friend class RemotePeeringEvent;
friend class PGAdvanceMap;
};
+template <class T>
+class PeeringEvent : public PhasedOperationT<T> {
+public:
+ static constexpr OperationTypeCode type = OperationTypeCode::peering_event;
+
protected:
PipelineHandle handle;
- PGPipeline &pp(PG &pg);
+ PGPeeringPipeline &pp(PG &pg);
ShardServices &shard_services;
PeeringCtx ctx;
}
virtual void on_pg_absent();
- virtual PeeringEvent::interruptible_future<> complete_rctx(Ref<PG>);
+
+ virtual typename PeeringEvent::template interruptible_future<>
+ complete_rctx(Ref<PG>);
+
virtual seastar::future<> complete_rctx_no_pg() { return seastar::now();}
virtual seastar::future<Ref<PG>> get_pg() = 0;
void print(std::ostream &) const final;
void dump_detail(ceph::Formatter* f) const final;
seastar::future<> start();
-
- std::tuple<
- StartEvent,
- PGPipeline::AwaitMap::BlockingEvent,
- PG_OSDMapGate::OSDMapBlocker::BlockingEvent,
- PGPipeline::Process::BlockingEvent,
- BackfillRecovery::BackfillRecoveryPipeline::Process::BlockingEvent,
-#if 0
- PGPipeline::WaitForActive::BlockingEvent,
- PGActivationBlocker::BlockingEvent,
- PGPipeline::RecoverMissing::BlockingEvent,
- PGPipeline::GetOBC::BlockingEvent,
- PGPipeline::WaitRepop::BlockingEvent,
- PGPipeline::SendReply::BlockingEvent,
-#endif
- CompletionEvent
- > tracking_events;
};
-class RemotePeeringEvent : public PeeringEvent {
+class RemotePeeringEvent : public PeeringEvent<RemotePeeringEvent> {
protected:
OSD &osd;
crimson::net::ConnectionRef conn;
conn(conn)
{}
+#if 0
std::tuple<
- OSDPipeline::AwaitActive::BlockingEvent,
+ > tracking_events;
+#endif
+
+ std::tuple<
+ StartEvent,
ConnectionPipeline::AwaitMap::BlockingEvent,
- ConnectionPipeline::GetPG::BlockingEvent
+ OSD_OSDMapGate::OSDMapBlocker::BlockingEvent,
+ ConnectionPipeline::GetPG::BlockingEvent,
+ PGMap::PGCreationBlockingEvent,
+ PGPeeringPipeline::AwaitMap::BlockingEvent,
+ PG_OSDMapGate::OSDMapBlocker::BlockingEvent,
+ PGPeeringPipeline::Process::BlockingEvent,
+ BackfillRecovery::BackfillRecoveryPipeline::Process::BlockingEvent,
+ OSDPipeline::AwaitActive::BlockingEvent,
+#if 0
+ PGPipeline::WaitForActive::BlockingEvent,
+ PGActivationBlocker::BlockingEvent,
+ PGPipeline::RecoverMissing::BlockingEvent,
+ PGPipeline::GetOBC::BlockingEvent,
+ PGPipeline::WaitRepop::BlockingEvent,
+ PGPipeline::SendReply::BlockingEvent,
+#endif
+ CompletionEvent
> tracking_events;
private:
ConnectionPipeline &cp();
OSDPipeline &op();
};
-class LocalPeeringEvent final : public PeeringEvent {
+class LocalPeeringEvent final : public PeeringEvent<LocalPeeringEvent> {
protected:
seastar::future<Ref<PG>> get_pg() final;
{}
virtual ~LocalPeeringEvent();
+
+ std::tuple<
+ StartEvent,
+ PGPeeringPipeline::AwaitMap::BlockingEvent,
+ PG_OSDMapGate::OSDMapBlocker::BlockingEvent,
+ PGPeeringPipeline::Process::BlockingEvent,
+ BackfillRecovery::BackfillRecoveryPipeline::Process::BlockingEvent,
+#if 0
+ PGPipeline::WaitForActive::BlockingEvent,
+ PGActivationBlocker::BlockingEvent,
+ PGPipeline::RecoverMissing::BlockingEvent,
+ PGPipeline::GetOBC::BlockingEvent,
+ PGPipeline::WaitRepop::BlockingEvent,
+ PGPipeline::SendReply::BlockingEvent,
+#endif
+ CompletionEvent
+ > tracking_events;
};
seastar::future<> start();
std::tuple<
- PeeringEvent::PGPipeline::Process::BlockingEvent
+ PGPeeringPipeline::Process::BlockingEvent
> tracking_events;
};
using cached_map_t = boost::local_shared_ptr<const OSDMap>;
ClientRequest::PGPipeline client_request_pg_pipeline;
- PeeringEvent::PGPipeline peering_request_pg_pipeline;
+ PGPeeringPipeline peering_request_pg_pipeline;
RepRequest::PGPipeline replicated_request_pg_pipeline;
spg_t pgid;
friend class ClientRequest;
friend struct CommonClientRequest;
friend class PGAdvanceMap;
+ template <class T>
friend class PeeringEvent;
friend class RepRequest;
friend class BackfillRecovery;