Initial doxygen comments on Db and Graph classes

Summary: Initial doxygen comments on Db and Graph classes

Test Plan: manual

Reviewers: sale

Subscribers: sale, buda

Differential Revision: https://memgraph.phacility.com/D23
This commit is contained in:
Marko Budiselic 2016-12-20 19:36:38 +01:00
parent 9640661519
commit ecbb0f0595
2 changed files with 65 additions and 10 deletions

View File

@ -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;
};

View File

@ -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;
};