@@ -235,19 +235,8 @@ seastar::future<CollectionRef> AlienStore::create_new_collection(const coll_t& c
235235 return tp->submit ([this , cid] {
236236 return store->create_new_collection (cid);
237237 }).then ([this , cid] (ObjectStore::CollectionHandle c) {
238- CollectionRef ch;
239- auto cp = coll_map.find (c->cid );
240- if (cp == coll_map.end ()) {
241- ch = new AlienCollection (c);
242- coll_map[c->cid ] = ch;
243- } else {
244- ch = cp->second ;
245- auto ach = static_cast <AlienCollection*>(ch.get ());
246- if (ach->collection != c) {
247- ach->collection = c;
248- }
249- }
250- return seastar::make_ready_future<CollectionRef>(ch);
238+ return seastar::make_ready_future<CollectionRef>(
239+ get_alien_coll_ref (std::move (c)));
251240 });
252241
253242}
@@ -262,19 +251,8 @@ seastar::future<CollectionRef> AlienStore::open_collection(const coll_t& cid)
262251 if (!c) {
263252 return seastar::make_ready_future<CollectionRef>();
264253 }
265- CollectionRef ch;
266- auto cp = coll_map.find (c->cid );
267- if (cp == coll_map.end ()){
268- ch = new AlienCollection (c);
269- coll_map[c->cid ] = ch;
270- } else {
271- ch = cp->second ;
272- auto ach = static_cast <AlienCollection*>(ch.get ());
273- if (ach->collection != c){
274- ach->collection = c;
275- }
276- }
277- return seastar::make_ready_future<CollectionRef>(ch);
254+ return seastar::make_ready_future<CollectionRef>(
255+ get_alien_coll_ref (std::move (c)));
278256 });
279257}
280258
@@ -657,4 +635,20 @@ AlienStore::read_errorator::future<std::map<uint64_t, uint64_t>> AlienStore::fie
657635 });
658636}
659637
638+ CollectionRef AlienStore::get_alien_coll_ref (ObjectStore::CollectionHandle c) {
639+ CollectionRef ch;
640+ auto cp = coll_map.find (c->cid );
641+ if (cp == coll_map.end ()) {
642+ ch = new AlienCollection (c);
643+ coll_map[c->cid ] = ch;
644+ } else {
645+ ch = cp->second ;
646+ auto ach = static_cast <AlienCollection*>(ch.get ());
647+ if (ach->collection != c) {
648+ ach->collection = c;
649+ }
650+ }
651+ return ch;
652+ }
653+
660654}
0 commit comments