diff --git a/include/database/db.hpp b/include/database/db.hpp index a9b18d4c7..0425eae78 100644 --- a/include/database/db.hpp +++ b/include/database/db.hpp @@ -10,44 +10,85 @@ 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. + +/** + * Main class which represents Database concept in code. + */ class Db { public: using sptr = std::shared_ptr<Db>; - // import_snapshot will in constructor import latest snapshot into the db. - // NOTE: explicit is here to prevent compiler from evaluating const char * - // into a bool. + /** + * This constructor will create a database with the name "default" + * + * NOTE: explicit is here to prevent compiler from evaluating const char * + * into a bool. + * + * @param import_snapshot will in constructor import latest snapshot + * into the db. + */ explicit Db(bool import_snapshot = true); - // import_snapshot will in constructor import latest snapshot into the db. + /** + * Construct database with a custom name. + * + * @param name database name + * @param import_snapshot will in constructor import latest snapshot + * into the db. + */ Db(const char *name, bool import_snapshot = true); - // import_snapshot will in constructor import latest snapshot into the db. + /** + * Construct database with a custom name. + * + * @param name database name + * @param import_snapshot will in constructor import latest snapshot + * into the db. + */ Db(const std::string &name, bool import_snapshot = true); + /** + * Database object can't be copied. + */ Db(const Db &db) = delete; private: + /** database name */ const std::string name_; public: + /** transaction engine related to this database */ tx::Engine tx_engine; + + /** graph related to this database */ Graph graph; + + /** garbage collector related to this database*/ Garbage garbage = {tx_engine}; - // This must be initialized after name. + /** + * snapshot engine related to this database + * + * \b IMPORTANT: has to be initialized after name + * */ SnapshotEngine snap_engine = {*this}; - // Creates Indexes for this db. + /** + * Creates Indexes for this database. + */ + Indexes indexes(); // TODO: Indexes should be created only once somwhere Like Db or layer // between Db and Dbms. - Indexes indexes(); + /** + * Returns a name of the database. + * + * @return database name + */ std::string const &name() const; }; diff --git a/include/storage/graph.hpp b/include/storage/graph.hpp index c14728658..7bda8fe0e 100644 --- a/include/storage/graph.hpp +++ b/include/storage/graph.hpp @@ -5,14 +5,28 @@ #include "storage/label/label_store.hpp" #include "storage/vertices.hpp" +/** + * Graph storage. Contains vertices and edges, labels and edges. + */ class Graph { public: - Graph() {} + /** + * default constructor + * + * At the beginning the graph is empty. + */ + Graph() = default; + /** storage for all vertices related to this graph */ Vertices vertices; + + /** storage for all edges related to this graph */ Edges edges; + /** storage for all labels */ LabelStore label_store; + + /** storage for all types related for this graph */ EdgeTypeStore edge_type_store; };