memgraph/include/database/db.hpp
Kruno Tomola Fabro 2a59ed8906 Minor refactorings:
Importes now use logger.

Refactored order of constrution of objects in Db.

Moved index creation/removing from Db to Indexes.

Completed Garbage class.
Cleaner now calls garbage.clean() for databases.

Renamed List to ConcurrentList which better names it.
2016-09-12 20:13:04 +01:00

45 lines
1.1 KiB
C++

#pragma once
#include "storage/type_group_edge.hpp"
#include "storage/type_group_vertex.hpp"
#include "snapshot/snapshot_engine.hpp"
#include "storage/garbage/garbage.hpp"
#include "storage/graph.hpp"
#include "transactions/engine.hpp"
class Indexes;
// Main class which represents Database concept in code.
// TODO: Maybe split this in another layer between Db and Dbms. Where the new
// layer would hold SnapshotEngine and his kind of concept objects. Some
// guidelines would be: retain objects which are necessary to implement querys
// in Db, the rest can be moved to the new layer.
class Db
{
public:
using sptr = std::shared_ptr<Db>;
Db();
Db(const std::string &name);
Db(const Db &db) = delete;
private:
const std::string name_;
public:
tx::Engine tx_engine;
Graph graph;
Garbage garbage = {tx_engine};
// This must be initialized after name.
SnapshotEngine snap_engine = {*this};
// Creates Indexes for this db.
// TODO: Indexes should be created only once somwhere Like Db or layer
// between Db and Dbms.
Indexes indexes();
std::string const &name() const;
};