23241e76b9
Summary: This diff contains step 1: - Remove clog exposure from tx::engine - Reduce and cleanup tx::Engine API All current functionality is kept, but the API is reduced. This is very desirable because every function in tx::Engine will need to be considered and implemented in both Master and Worker situations. The less we have, the better. Next step is exactly that: seeing how each of these functions behaves in a distributed system and implementing accordingly. Reviewers: dgleich, mislav.bradac, buda Reviewed By: mislav.bradac Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1008
40 lines
999 B
C++
40 lines
999 B
C++
#pragma once
|
|
|
|
#include "mvcc/record.hpp"
|
|
|
|
/**
|
|
* @brief - Empty class which inherits from mvcc:Record.
|
|
*/
|
|
class Prop : public mvcc::Record<Prop> {
|
|
public:
|
|
Prop *CloneData() { return new Prop; }
|
|
};
|
|
|
|
/**
|
|
* @brief - Class which inherits from mvcc::Record and takes an atomic variable
|
|
* to count number of destructor calls (to test if the record is actually
|
|
* deleted).
|
|
*/
|
|
class DestrCountRec : public mvcc::Record<DestrCountRec> {
|
|
public:
|
|
DestrCountRec(std::atomic<int> &count) : count_(count) {}
|
|
DestrCountRec *CloneData() { return new DestrCountRec(count_); }
|
|
~DestrCountRec() { ++count_; }
|
|
|
|
private:
|
|
std::atomic<int> &count_;
|
|
};
|
|
|
|
// helper function for creating a GC snapshot
|
|
// if given a nullptr it makes a GC snapshot like there
|
|
// are no active transactions
|
|
auto GcSnapshot(tx::Engine &engine, tx::Transaction *t) {
|
|
if (t != nullptr) {
|
|
tx::Snapshot gc_snap = t->snapshot();
|
|
gc_snap.insert(t->id_);
|
|
return gc_snap;
|
|
} else {
|
|
return engine.GcSnapshot();
|
|
}
|
|
}
|