*/
class Transaction {
public:
- OrderingHandle handle;
-
using Ref = std::unique_ptr<Transaction>;
enum class get_extent_ret {
PRESENT,
return conflicted;
}
+ auto &get_handle() {
+ return handle;
+ }
+
+ Transaction(
+ OrderingHandle &&handle,
+ bool weak,
+ journal_seq_t initiated_after
+ ) : weak(weak),
+ retired_gate_token(initiated_after),
+ handle(std::move(handle))
+ {}
+
+
+ ~Transaction() {
+ for (auto i = write_set.begin();
+ i != write_set.end();) {
+ i->state = CachedExtent::extent_state_t::INVALID;
+ write_set.erase(*i++);
+ }
+ }
+
+ friend class crimson::os::seastore::SeaStore;
+ friend class TransactionConflictCondition;
+
private:
friend class Cache;
friend Ref make_test_transaction();
bool conflicted = false;
-public:
- Transaction(
- OrderingHandle &&handle,
- bool weak,
- journal_seq_t initiated_after
- ) : handle(std::move(handle)), weak(weak),
- retired_gate_token(initiated_after) {}
-
- ~Transaction() {
- for (auto i = write_set.begin();
- i != write_set.end();) {
- i->state = CachedExtent::extent_state_t::INVALID;
- write_set.erase(*i++);
- }
- }
-
- friend class crimson::os::seastore::SeaStore;
- friend class TransactionConflictCondition;
+ OrderingHandle handle;
};
using TransactionRef = Transaction::Ref;
LOG_PREFIX(TransactionManager::submit_transaction);
DEBUGT("about to await throttle", t);
return trans_intr::make_interruptible(
- t.handle.enter(write_pipeline.wait_throttle)
+ t.get_handle().enter(write_pipeline.wait_throttle)
).then_interruptible([this] {
return trans_intr::make_interruptible(segment_cleaner->await_hard_limits());
}).then_interruptible([this, &t]() {
LOG_PREFIX(TransactionManager::submit_transaction_direct);
DEBUGT("about to prepare", tref);
return trans_intr::make_interruptible(
- tref.handle.enter(write_pipeline.prepare)
+ tref.get_handle().enter(write_pipeline.prepare)
).then_interruptible([this, FNAME, &tref]() mutable
-> submit_transaction_iertr::future<> {
auto record = cache->try_construct_record(tref);
DEBUGT("about to submit to journal", tref);
- return journal->submit_record(std::move(*record), tref.handle
+ return journal->submit_record(std::move(*record), tref.get_handle()
).safe_then([this, FNAME, &tref](auto p) mutable {
auto [addr, journal_seq] = p;
DEBUGT("journal commit to {} seq {}", tref, addr, journal_seq);
return SegmentManager::release_ertr::now();
}
}).safe_then([&tref] {
- return tref.handle.complete();
+ return tref.get_handle().complete();
}).handle_error(
submit_transaction_iertr::pass_further{},
crimson::ct_error::all_same_way([](auto e) {
ceph_assert(0 == "Hit error submitting to journal");
}));
}).finally([&tref]() {
- tref.handle.exit();
+ tref.get_handle().exit();
});
}