backoff_lock("PG::backoff_lock"),
scrub_after_recovery(false),
active_pushes(0),
- recovery_state(cct, info.pgid, this),
+ recovery_state(cct, info.pgid, this, this, this),
peer_features(CEPH_FEATURES_SUPPORTED_DEFAULT),
acting_features(CEPH_FEATURES_SUPPORTED_DEFAULT),
upacting_features(CEPH_FEATURES_SUPPORTED_DEFAULT),
*
*/
-class PG : public DoutPrefixProvider, public EpochSource {
+class PG : public DoutPrefixProvider, public PeeringState::PeeringListener {
friend class NamedState;
friend class PeeringState;
public:
#include "messages/MRecoveryReserve.h"
#include "messages/MOSDScrubReserve.h"
-PeeringState::PeeringState(CephContext *cct, spg_t spgid, PG *pg)
+PeeringState::PeeringState(
+ CephContext *cct,
+ spg_t spgid,
+ DoutPrefixProvider *dpp,
+ PeeringListener *pl,
+ PG *pg)
: state_history(pg),
- machine(this, cct, spgid, pg, &state_history), cct(cct),
- spgid(spgid), pg(pg), orig_ctx(0) {
+ machine(this, cct, spgid, dpp, pl, pg, &state_history), cct(cct),
+ spgid(spgid), dpp(dpp), pl(pl), pg(pg), orig_ctx(0) {
machine.initiate();
}
#define dout_context cct
#define dout_subsys ceph_subsys_osd
#undef dout_prefix
-#define dout_prefix (context< PeeringMachine >().pg->gen_prefix(*_dout) \
+#define dout_prefix (context< PeeringMachine >().dpp->gen_prefix(*_dout) \
<< "state<" << get_state_name() << ">: ")
#define psdout(x) ldout(context< PeeringMachine >().cct, x)
#include <boost/statechart/state_machine.hpp>
#include <boost/statechart/transition.hpp>
#include <boost/statechart/event_base.hpp>
+#include <string>
#include "PGStateUtils.h"
#include "PGPeeringEvent.h"
/* Encapsulates PG recovery process */
class PeeringState {
public:
+ struct PeeringListener : public EpochSource {
+ virtual ~PeeringListener() {}
+ };
+
// [primary only] content recovery state
struct BufferedRecoveryMessages {
map<int, map<spg_t, pg_query_t> > query_map;
PGStateHistory *state_history;
CephContext *cct;
spg_t spgid;
+ DoutPrefixProvider *dpp;
+ PeeringListener *pl;
PG *pg;
utime_t event_time;
PeeringMachine(
PeeringState *state, CephContext *cct,
- spg_t spgid, PG *pg,
+ spg_t spgid,
+ DoutPrefixProvider *dpp,
+ PeeringListener *pl,
+ PG *pg,
PGStateHistory *state_history) :
state(state),
state_history(state_history),
cct(cct), spgid(spgid),
+ dpp(dpp), pl(pl),
pg(pg), event_count(0) {}
/* Accessor functions for state methods */
PeeringMachine machine;
CephContext* cct;
spg_t spgid;
+ DoutPrefixProvider *dpp;
+ PeeringListener *pl;
PG *pg;
/// context passed in by state machine caller
boost::optional<PeeringCtx> rctx;
public:
- PeeringState(CephContext *cct, spg_t spgid, PG *pg);
+ PeeringState(
+ CephContext *cct,
+ spg_t spgid,
+ DoutPrefixProvider *dpp,
+ PeeringListener *pl,
+ PG *pg);
void handle_event(const boost::statechart::event_base &evt,
PeeringCtx *rctx) {