~AlienCollection() {}
+ template <typename Func, typename Result = std::invoke_result_t<Func>>
+ seastar::futurize_t<Result> with_lock(Func&& func) {
+ return seastar::with_lock(mutex, std::forward<Func>(func));
+ }
+
private:
ObjectStore::CollectionHandle collection;
+ seastar::shared_mutex mutex;
friend AlienStore;
};
}
std::move(done),
[this, ch, id] (auto &txn, auto &done) {
return seastar::with_gate(transaction_gate, [this, ch, id, &txn, &done] {
- return tp_mutex.lock().then ([this, ch, id, &txn, &done] {
+ AlienCollection* alien_coll = static_cast<AlienCollection*>(ch.get());
+ return alien_coll->with_lock([this, ch, id, &txn, &done] {
Context *crimson_wrapper =
ceph::os::Transaction::collect_all_contexts(txn);
return tp->submit([this, ch, id, crimson_wrapper, &txn, &done] {
});
}).then([this, &done] (int r) {
assert(r == 0);
- tp_mutex.unlock();
return done.get_future();
});
});
std::unique_ptr<CephContext> cct;
seastar::gate transaction_gate;
std::unordered_map<coll_t, CollectionRef> coll_map;
- seastar::shared_mutex tp_mutex;
};
}