@@ -44,8 +44,9 @@ static std::string latest_epoch_oid(const ceph::common::ConfigProxy& conf,
4444 period_latest_epoch_info_oid));
4545}
4646
47- int RadosConfigStore::read_latest_epoch (const DoutPrefixProvider* dpp, optional_yield y, std::string_view period_id,
48- uint32_t & epoch, RGWObjVersionTracker* objv, RGWPeriod& info)
47+ static int read_latest_epoch (const DoutPrefixProvider* dpp, optional_yield y,
48+ ConfigImpl* impl, std::string_view period_id,
49+ uint32_t & epoch, RGWObjVersionTracker* objv)
4950{
5051 const auto & pool = impl->period_pool ;
5152 const auto latest_oid = latest_epoch_oid (dpp->get_cct ()->_conf , period_id);
@@ -57,9 +58,10 @@ int RadosConfigStore::read_latest_epoch(const DoutPrefixProvider* dpp, optional_
5758 return r;
5859}
5960
60- int RadosConfigStore::write_latest_epoch (const DoutPrefixProvider* dpp, optional_yield y, bool exclusive,
61- std::string_view period_id, uint32_t epoch, RGWObjVersionTracker* objv,
62- const RGWPeriod& info)
61+ static int write_latest_epoch (const DoutPrefixProvider* dpp, optional_yield y,
62+ ConfigImpl* impl, bool exclusive,
63+ std::string_view period_id, uint32_t epoch,
64+ RGWObjVersionTracker* objv)
6365{
6466 const auto & pool = impl->period_pool ;
6567 const auto latest_oid = latest_epoch_oid (dpp->get_cct ()->_conf , period_id);
@@ -77,9 +79,8 @@ static int delete_latest_epoch(const DoutPrefixProvider* dpp, optional_yield y,
7779 return impl->remove (dpp, y, pool, latest_oid, objv);
7880}
7981
80- static int update_latest_epoch (const DoutPrefixProvider* dpp, optional_yield y,
81- RadosConfigStore& rados_config_store, std::string_view period_id,
82- uint32_t epoch, RGWPeriod& info)
82+ int RadosConfigStore::update_latest_epoch (const DoutPrefixProvider* dpp, optional_yield y,
83+ std::string_view period_id, uint32_t epoch)
8384{
8485 static constexpr int MAX_RETRIES = 20 ;
8586
@@ -89,7 +90,7 @@ static int update_latest_epoch(const DoutPrefixProvider* dpp, optional_yield y,
8990 bool exclusive = false ;
9091
9192 // read existing epoch
92- int r = rados_config_store. read_latest_epoch (dpp, y, period_id, existing_epoch, &objv, info );
93+ int r = read_latest_epoch (dpp, y, impl. get (), period_id, existing_epoch, &objv);
9394 if (r == -ENOENT) {
9495 // use an exclusive create to set the epoch atomically
9596 exclusive = true ;
@@ -109,7 +110,7 @@ static int update_latest_epoch(const DoutPrefixProvider* dpp, optional_yield y,
109110 << " -> " << epoch << " on period=" << period_id << dendl;
110111 }
111112
112- r = rados_config_store. write_latest_epoch (dpp, y, exclusive, period_id, epoch, &objv, info );
113+ r = write_latest_epoch (dpp, y, impl. get (), exclusive, period_id, epoch, &objv);
113114 if (r == -EEXIST) {
114115 continue ; // exclusive create raced with another update, retry
115116 } else if (r == -ECANCELED) {
@@ -148,8 +149,7 @@ int RadosConfigStore::create_period(const DoutPrefixProvider* dpp,
148149 }
149150
150151 // non const RGWPeriod
151- RGWPeriod info_copy = info;
152- (void ) update_latest_epoch (dpp, y, *this , info.get_id (), info.get_epoch (), info_copy);
152+ (void ) this ->update_latest_epoch (dpp, y, info.get_id (), info.get_epoch ());
153153 return 0 ;
154154}
155155
@@ -162,7 +162,7 @@ int RadosConfigStore::read_period(const DoutPrefixProvider* dpp,
162162 int r = 0 ;
163163 if (!epoch) {
164164 epoch = 0 ;
165- r = read_latest_epoch (dpp, y, period_id, *epoch, nullptr , info );
165+ r = read_latest_epoch (dpp, y, impl. get (), period_id, *epoch, nullptr );
166166 if (r < 0 ) {
167167 return r;
168168 }
@@ -182,8 +182,7 @@ int RadosConfigStore::delete_period(const DoutPrefixProvider* dpp,
182182 // read the latest_epoch
183183 uint32_t latest_epoch = 0 ;
184184 RGWObjVersionTracker latest_objv;
185- RGWPeriod period; // not used in RadosConfigStore, but needed in the API
186- int r = read_latest_epoch (dpp, y, period_id, latest_epoch, &latest_objv, period);
185+ int r = read_latest_epoch (dpp, y, impl.get (), period_id, latest_epoch, &latest_objv);
187186 if (r < 0 && r != -ENOENT) { // just delete epoch=0 on ENOENT
188187 ldpp_dout (dpp, 0 ) << " failed to read latest epoch for period "
189188 << period_id << " : " << cpp_strerror (r) << dendl;
0 commit comments