return tp->submit([this, cid] {
return store->create_new_collection(cid);
}).then([this, cid] (ObjectStore::CollectionHandle c) {
- CollectionRef ch;
- auto cp = coll_map.find(c->cid);
- if (cp == coll_map.end()) {
- ch = new AlienCollection(c);
- coll_map[c->cid] = ch;
- } else {
- ch = cp->second;
- auto ach = static_cast<AlienCollection*>(ch.get());
- if (ach->collection != c) {
- ach->collection = c;
- }
- }
- return seastar::make_ready_future<CollectionRef>(ch);
+ return seastar::make_ready_future<CollectionRef>(
+ get_alien_coll_ref(std::move(c)));
});
}
if (!c) {
return seastar::make_ready_future<CollectionRef>();
}
- CollectionRef ch;
- auto cp = coll_map.find(c->cid);
- if (cp == coll_map.end()){
- ch = new AlienCollection(c);
- coll_map[c->cid] = ch;
- } else {
- ch = cp->second;
- auto ach = static_cast<AlienCollection*>(ch.get());
- if (ach->collection != c){
- ach->collection = c;
- }
- }
- return seastar::make_ready_future<CollectionRef>(ch);
+ return seastar::make_ready_future<CollectionRef>(
+ get_alien_coll_ref(std::move(c)));
});
}
});
}
+CollectionRef AlienStore::get_alien_coll_ref(ObjectStore::CollectionHandle c) {
+ CollectionRef ch;
+ auto cp = coll_map.find(c->cid);
+ if (cp == coll_map.end()) {
+ ch = new AlienCollection(c);
+ coll_map[c->cid] = ch;
+ } else {
+ ch = cp->second;
+ auto ach = static_cast<AlienCollection*>(ch.get());
+ if (ach->collection != c) {
+ ach->collection = c;
+ }
+ }
+ return ch;
+}
+
}