Summary: Initial implementation of new storage engine. It implements snapshot isolation for transactions. All changes in the database are stored as deltas instead of making full copies. Currently, the storage supports full transaction functionality (commit, abort, command advancement). Also, support has been implemented only for vertices that have only labels. Reviewers: teon.banek, mtomic Reviewed By: teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D2138
46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "utils/cast.hpp"
|
|
|
|
namespace storage {
|
|
|
|
class Gid final {
|
|
private:
|
|
explicit Gid(uint64_t gid) : gid_(gid) {}
|
|
|
|
public:
|
|
static Gid FromUint(uint64_t gid) { return Gid{gid}; }
|
|
|
|
static Gid FromInt(int64_t gid) {
|
|
return Gid{utils::MemcpyCast<uint64_t>(gid)};
|
|
}
|
|
|
|
uint64_t AsUint() const { return gid_; }
|
|
|
|
int64_t AsInt() const { return utils::MemcpyCast<int64_t>(gid_); }
|
|
|
|
private:
|
|
uint64_t gid_;
|
|
};
|
|
|
|
inline bool operator==(const Gid &first, const Gid &second) {
|
|
return first.AsUint() == second.AsUint();
|
|
}
|
|
inline bool operator!=(const Gid &first, const Gid &second) {
|
|
return first.AsUint() != second.AsUint();
|
|
}
|
|
inline bool operator<(const Gid &first, const Gid &second) {
|
|
return first.AsUint() < second.AsUint();
|
|
}
|
|
inline bool operator>(const Gid &first, const Gid &second) {
|
|
return first.AsUint() > second.AsUint();
|
|
}
|
|
inline bool operator<=(const Gid &first, const Gid &second) {
|
|
return first.AsUint() <= second.AsUint();
|
|
}
|
|
inline bool operator>=(const Gid &first, const Gid &second) {
|
|
return first.AsUint() >= second.AsUint();
|
|
}
|
|
|
|
} // namespace storage
|