*
* Determines the whether _have is suffient to recover an object
*/
- class ECRecPred : public IsRecoverablePredicate {
+ class ECRecPred : public IsPGRecoverablePredicate {
set<int> want;
ErasureCodeInterfaceRef ec_impl;
public:
return ec_impl->minimum_to_decode(want, have, &min) == 0;
}
};
- IsRecoverablePredicate *get_is_recoverable_predicate() {
+ IsPGRecoverablePredicate *get_is_recoverable_predicate() {
return new ECRecPred(ec_impl);
}
*
* Determines the whether _have is suffient to read an object
*/
- class ECReadPred : public IsReadablePredicate {
+ class ECReadPred : public IsPGReadablePredicate {
pg_shard_t whoami;
ECRecPred rec_pred;
public:
return _have.count(whoami) && rec_pred(_have);
}
};
- IsReadablePredicate *get_is_readable_predicate() {
+ IsPGReadablePredicate *get_is_readable_predicate() {
return new ECReadPred(get_parent()->whoami_shard(), ec_impl);
}
}
/* Check whether we have enough acting shards to later perform recovery */
- boost::scoped_ptr<PGBackend::IsRecoverablePredicate> recoverable_predicate(
+ boost::scoped_ptr<IsPGRecoverablePredicate> recoverable_predicate(
get_pgbackend()->get_is_recoverable_predicate());
set<pg_shard_t> have;
for (int i = 0; i < (int)want.size(); ++i) {
#define dout_prefix (*_dout << (debug_pg ? debug_pg->gen_prefix() : string()) << " PriorSet: ")
PG::PriorSet::PriorSet(bool ec_pool,
- PGBackend::IsRecoverablePredicate *c,
+ IsPGRecoverablePredicate *c,
const OSDMap &osdmap,
const map<epoch_t, pg_interval_t> &past_intervals,
const vector<int> &up,
PG *pg;
set<pg_shard_t> empty_set;
public:
- boost::scoped_ptr<PGBackend::IsReadablePredicate> is_readable;
- boost::scoped_ptr<PGBackend::IsRecoverablePredicate> is_recoverable;
+ boost::scoped_ptr<IsPGReadablePredicate> is_readable;
+ boost::scoped_ptr<IsPGRecoverablePredicate> is_recoverable;
MissingLoc(PG *pg)
: pg(pg) {}
void set_backend_predicates(
- PGBackend::IsReadablePredicate *_is_readable,
- PGBackend::IsRecoverablePredicate *_is_recoverable) {
+ IsPGReadablePredicate *_is_readable,
+ IsPGRecoverablePredicate *_is_recoverable) {
is_readable.reset(_is_readable);
is_recoverable.reset(_is_recoverable);
}
map<int, epoch_t> blocked_by; /// current lost_at values for any OSDs in cur set for which (re)marking them lost would affect cur set
bool pg_down; /// some down osds are included in @a cur; the DOWN pg state bit should be set.
- boost::scoped_ptr<PGBackend::IsRecoverablePredicate> pcontdec;
+ boost::scoped_ptr<IsPGRecoverablePredicate> pcontdec;
PriorSet(bool ec_pool,
- PGBackend::IsRecoverablePredicate *c,
+ IsPGRecoverablePredicate *c,
const OSDMap &osdmap,
const map<epoch_t, pg_interval_t> &past_intervals,
const vector<int> &up,
virtual void on_flushed() = 0;
- class IsRecoverablePredicate {
- public:
- /**
- * have encodes the shards available
- */
- virtual bool operator()(const set<pg_shard_t> &have) const = 0;
- virtual ~IsRecoverablePredicate() {}
- };
- virtual IsRecoverablePredicate *get_is_recoverable_predicate() = 0;
-
- class IsReadablePredicate {
- public:
- /**
- * have encodes the shards available
- */
- virtual bool operator()(const set<pg_shard_t> &have) const = 0;
- virtual ~IsReadablePredicate() {}
- };
- virtual IsReadablePredicate *get_is_readable_predicate() = 0;
+ virtual IsPGRecoverablePredicate *get_is_recoverable_predicate() = 0;
+ virtual IsPGReadablePredicate *get_is_readable_predicate() = 0;
virtual void dump_recovery_info(Formatter *f) const = 0;
void clear_recovery_state();
void on_flushed();
- class RPCRecPred : public IsRecoverablePredicate {
+ class RPCRecPred : public IsPGRecoverablePredicate {
public:
bool operator()(const set<pg_shard_t> &have) const {
return !have.empty();
}
};
- IsRecoverablePredicate *get_is_recoverable_predicate() {
+ IsPGRecoverablePredicate *get_is_recoverable_predicate() {
return new RPCRecPred;
}
- class RPCReadPred : public IsReadablePredicate {
+ class RPCReadPred : public IsPGReadablePredicate {
pg_shard_t whoami;
public:
RPCReadPred(pg_shard_t whoami) : whoami(whoami) {}
return have.count(whoami);
}
};
- IsReadablePredicate *get_is_readable_predicate() {
+ IsPGReadablePredicate *get_is_readable_predicate() {
return new RPCReadPred(get_parent()->whoami_shard());
}
WRITE_CMP_OPERATORS_2(pg_shard_t, osd, shard)
ostream &operator<<(ostream &lhs, const pg_shard_t &rhs);
+class IsPGRecoverablePredicate {
+public:
+ /**
+ * have encodes the shards available
+ */
+ virtual bool operator()(const set<pg_shard_t> &have) const = 0;
+ virtual ~IsPGRecoverablePredicate() {}
+};
+
+class IsPGReadablePredicate {
+public:
+ /**
+ * have encodes the shards available
+ */
+ virtual bool operator()(const set<pg_shard_t> &have) const = 0;
+ virtual ~IsPGReadablePredicate() {}
+};
+
inline ostream& operator<<(ostream& out, const osd_reqid_t& r) {
return out << r.name << "." << r.inc << ":" << r.tid;
}