From 5ccaa44292c194882aa58b0cf35e70df5790fcc9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 8 Sep 2025 20:45:54 +0200 Subject: [PATCH] mon/ElectionLogic: forward-declare class ConnectionTracker Signed-off-by: Max Kellermann --- src/mon/ElectionLogic.cc | 16 ++++++++++++++++ src/mon/ElectionLogic.h | 16 ++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/mon/ElectionLogic.cc b/src/mon/ElectionLogic.cc index be0c35d06ac5..0af1c95a6191 100644 --- a/src/mon/ElectionLogic.cc +++ b/src/mon/ElectionLogic.cc @@ -13,6 +13,7 @@ */ #include "ElectionLogic.h" +#include "ConnectionTracker.h" #include "include/ceph_assert.h" #include "common/dout.h" @@ -55,6 +56,21 @@ static ostream& _prefix(std::ostream *_dout, epoch_t epoch, ElectionOwner* elect return *_dout << "paxos." << elector->get_my_rank() << ").electionLogic(" << epoch << ") "; } + +ElectionLogic::ElectionLogic(ElectionOwner *e, election_strategy es, ConnectionTracker *t, + double ipm, + CephContext *c) : elector(e), peer_tracker(t), cct(c), + last_election_winner(-1), last_voted_for(-1), + ignore_propose_margin(ipm), + stable_peer_tracker(), + leader_peer_tracker(), + leader_acked(-1), + strategy(es), + participating(true), + electing_me(false) {} + +ElectionLogic::~ElectionLogic() noexcept = default; + void ElectionLogic::init() { epoch = elector->read_persisted_epoch(); diff --git a/src/mon/ElectionLogic.h b/src/mon/ElectionLogic.h index 318ecb56cc6d..818e91566f61 100644 --- a/src/mon/ElectionLogic.h +++ b/src/mon/ElectionLogic.h @@ -23,7 +23,8 @@ #include "common/ceph_context.h" #include "include/buffer_fwd.h" #include "include/types.h" -#include "ConnectionTracker.h" + +class ConnectionTracker; class ElectionOwner { public: @@ -226,15 +227,10 @@ public: ElectionLogic(ElectionOwner *e, election_strategy es, ConnectionTracker *t, double ipm, - CephContext *c) : elector(e), peer_tracker(t), cct(c), - last_election_winner(-1), last_voted_for(-1), - ignore_propose_margin(ipm), - stable_peer_tracker(), - leader_peer_tracker(), - leader_acked(-1), - strategy(es), - participating(true), - electing_me(false) {} + CephContext *c); + + ~ElectionLogic() noexcept; + /** * Set the election strategy to use. If this is not consistent across the * electing cluster, you're going to have a bad time. -- 2.47.3