// mock puller that throws an exception if it's called
struct ErrorPuller : public RGWPeriodHistory::Puller {
- int pull(const DoutPrefixProvider *dpp, const std::string& id, RGWPeriod& period, optional_yield) override {
+ int pull(const DoutPrefixProvider *dpp, const std::string& id, RGWPeriod& period, optional_yield, rgw::sal::ConfigStore* cfgstore) override {
throw std::runtime_error("unexpected call to pull");
}
};
public:
explicit RecordingPuller(int error) : error(error) {}
Ids ids;
- int pull(const DoutPrefixProvider *dpp, const std::string& id, RGWPeriod& period, optional_yield) override {
+ int pull(const DoutPrefixProvider *dpp, const std::string& id, RGWPeriod& period, optional_yield, rgw::sal::ConfigStore* cfgstore) override {
ids.push_back(id);
return error;
}
// mock puller that returns a fake period by parsing the period id
struct NumericPuller : public RGWPeriodHistory::Puller {
- int pull(const DoutPrefixProvider *dpp, const std::string& id, RGWPeriod& period, optional_yield) override {
+ int pull(const DoutPrefixProvider *dpp, const std::string& id, RGWPeriod& period, optional_yield, rgw::sal::ConfigStore* cfgstore) override {
// relies on numeric period ids to divine the realm_epoch
auto realm_epoch = boost::lexical_cast<epoch_t>(id);
auto predecessor = boost::lexical_cast<std::string>(realm_epoch-1);
// create a disjoint history at 1 and verify that periods are requested
// backwards from current_period
- auto c1 = history.attach(&dp, make_period("1", 1, ""), null_yield);
+ auto c1 = history.attach(&dp, make_period("1", 1, ""), null_yield, nullptr);
ASSERT_FALSE(c1);
ASSERT_EQ(-EFAULT, c1.get_error());
ASSERT_EQ(Ids{"4"}, puller.ids);
auto c4 = history.insert(make_period("4", 4, "3"));
ASSERT_TRUE(c4);
- c1 = history.attach(&dp, make_period("1", 1, ""), null_yield);
+ c1 = history.attach(&dp, make_period("1", 1, ""), null_yield, nullptr);
ASSERT_FALSE(c1);
ASSERT_EQ(-EFAULT, c1.get_error());
ASSERT_EQ(Ids({"4", "3"}), puller.ids);
auto c3 = history.insert(make_period("3", 3, "2"));
ASSERT_TRUE(c3);
- c1 = history.attach(&dp, make_period("1", 1, ""), null_yield);
+ c1 = history.attach(&dp, make_period("1", 1, ""), null_yield, nullptr);
ASSERT_FALSE(c1);
ASSERT_EQ(-EFAULT, c1.get_error());
ASSERT_EQ(Ids({"4", "3", "2"}), puller.ids);
auto c2 = history.insert(make_period("2", 2, "1"));
ASSERT_TRUE(c2);
- c1 = history.attach(&dp, make_period("1", 1, ""), null_yield);
+ c1 = history.attach(&dp, make_period("1", 1, ""), null_yield, nullptr);
ASSERT_TRUE(c1);
ASSERT_EQ(Ids({"4", "3", "2"}), puller.ids);
}
// create a disjoint history at 9 and verify that periods are requested
// backwards down to current_period
- auto c9 = history.attach(&dp, make_period("9", 9, "8"), null_yield);
+ auto c9 = history.attach(&dp, make_period("9", 9, "8"), null_yield, nullptr);
ASSERT_FALSE(c9);
ASSERT_EQ(-EFAULT, c9.get_error());
ASSERT_EQ(Ids{"8"}, puller.ids);
- auto c8 = history.attach(&dp, make_period("8", 8, "7"), null_yield);
+ auto c8 = history.attach(&dp, make_period("8", 8, "7"), null_yield, nullptr);
ASSERT_FALSE(c8);
ASSERT_EQ(-EFAULT, c8.get_error());
ASSERT_EQ(Ids({"8", "7"}), puller.ids);
- auto c7 = history.attach(&dp, make_period("7", 7, "6"), null_yield);
+ auto c7 = history.attach(&dp, make_period("7", 7, "6"), null_yield, nullptr);
ASSERT_FALSE(c7);
ASSERT_EQ(-EFAULT, c7.get_error());
ASSERT_EQ(Ids({"8", "7", "6"}), puller.ids);
- auto c6 = history.attach(&dp, make_period("6", 6, "5"), null_yield);
+ auto c6 = history.attach(&dp, make_period("6", 6, "5"), null_yield, nullptr);
ASSERT_TRUE(c6);
ASSERT_EQ(Ids({"8", "7", "6"}), puller.ids);
}
RGWPeriodHistory history(g_ceph_context, &puller, current_period);
const DoutPrefix dp(g_ceph_context, 1, "test rgw period history: ");
- auto c1 = history.attach(&dp, make_period("1", 1, ""), null_yield);
+ auto c1 = history.attach(&dp, make_period("1", 1, ""), null_yield, nullptr);
ASSERT_TRUE(c1);
// verify that we pulled and merged all periods from 1-5
RGWPeriodHistory history(g_ceph_context, &puller, current_period);
const DoutPrefix dp(g_ceph_context, 1, "test rgw period history: ");
- auto c9 = history.attach(&dp, make_period("9", 9, "8"), null_yield);
+ auto c9 = history.attach(&dp, make_period("9", 9, "8"), null_yield, nullptr);
ASSERT_TRUE(c9);
// verify that we pulled and merged all periods from 5-9