Skip to content

Commit

Permalink
Documentation changes
Browse files Browse the repository at this point in the history
  • Loading branch information
whatsthecraic committed Dec 7, 2021
1 parent 1422757 commit e98c1a6
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 32 deletions.
40 changes: 19 additions & 21 deletions include/teseo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ class Transaction; // forward declaration
*****************************************************************************/

/**
* All exceptions thrown by Teseo are instances of the class or one of the subclasses of Error.
* All exceptions thrown by Teseo are instances of this class or one of its subclasses.
*/
class Exception : public std::runtime_error {
const std::string m_class; // The actual class of this exception
const std::string m_file; // The file path where the exception has been thrown
int m_line; // The line in the file that thrown the exception
const std::string m_function; // The funciton where the exception originated
const std::string m_file; // The file path where the exception was thrown
int m_line; // The line in the file where the exception was thrown
const std::string m_function; // The function where the exception originated

public:
/**
Expand All @@ -59,7 +59,7 @@ class Exception : public std::runtime_error {
const std::string& file() const;

/**
* Get the name of the function in the source code where this exception was throwns
* Get the name of the function in the source code where this exception was thrown
*/
const std::string& function() const;

Expand All @@ -70,15 +70,15 @@ class Exception : public std::runtime_error {
};

/**
* A logical error, due to the incorrect usage of the API or an inconsistent state of the transaction
* A logical error, due to the incorrect usage of the API or an inconsistent state of the transaction.
*/
class LogicalError : public Exception {
public:
LogicalError(const std::string& exc_class, const std::string& message, const std::string& file, int line, const std::string& function);
};

/**
* A logical error related to a vertex. It is raised when attempting to refer a non existing vertex or to re-insert a vertex that already exists.
* A logical error related to a vertex. It is raised when attempting to refer to a non existing vertex or to re-insert a vertex that already exists.
*/
class VertexError: public LogicalError {
const uint64_t m_vertex; // the vertex being referred
Expand Down Expand Up @@ -107,17 +107,16 @@ class EdgeError: public LogicalError {
uint64_t destination() const noexcept;
};


/**
* An exception raised when attempting to alter a record currently locked by another pending transaction, that is a conflict.
* An exception raised when attempting to alter a record currently locked by another pending transaction, that is, a conflict.
*/
class TransactionConflict : public Exception {
public:
TransactionConflict(const std::string& exc_class, const std::string& message, const std::string& file, int line, const std::string& function);
};

/**
* Print to the output stream a description of the given error
* Print to the output stream a description of the given error.
*/
std::ostream& operator<<(const Exception& error, std::ostream& out);

Expand Down Expand Up @@ -206,7 +205,6 @@ class Transaction {
Transaction(void* opaque_handle);

public:

/**
* Copy constructor
*/
Expand Down Expand Up @@ -238,9 +236,9 @@ class Transaction {
* @throws TransactionConflict if the record to alter in the storage is
* currently locked by another pending transaction
* @throws LogicalError if any of the following conditions occur:
* - if the transaction was created in read only mode
* - the transaction was created in read only mode
* - the transaction has already been terminated, by roll back or commit
* - if the vertex being inserted already exists
* - the vertex being inserted already exists
*/
void insert_vertex(uint64_t vertex_id);

Expand All @@ -262,9 +260,9 @@ class Transaction {
* @param vertex_id the identifier of the vertex to remove
* @return the number of attached edges removed
* @throws LogicalError if any of the following conditions occur:
* - if the transaction was created in read only mode
* - the transaction was created in read only mode
* - the transaction has already been terminated, by roll back or commit
* - if the vertex id does not exist
* - the vertex id does not exist
*/
uint64_t remove_vertex(uint64_t vertex_id);

Expand All @@ -276,10 +274,10 @@ class Transaction {
* @throws TransactionConflict if the record to alter in the storage is
* currently locked by another pending transaction
* @throws LogicalError if any of the following conditions occur:
* - if the transaction was created in read only mode
* - the transaction was created in read only mode
* - the transaction has already been terminated, by roll back or commit
* - if either the source or destination vertices do not already exist
* - if the edge being inserted already exists
* - either the source or destination vertices do not already exist
* - the edge being inserted already exists
*/
void insert_edge(uint64_t source, uint64_t destination, double weight);

Expand All @@ -300,9 +298,9 @@ class Transaction {
* @throws TransactionConflict if the record to alter in the storage is
* currently locked by another pending transaction
* @throws LogicalError if any of the following conditions occur:
* - if the transaction was created in read only mode
* - the transaction was created in read only mode
* - the transaction has already been terminated, by roll back or commit
* - if the edge to remove does not exist
* - the edge to remove does not exist
*/
void remove_edge(uint64_t source, uint64_t destination);

Expand Down Expand Up @@ -399,7 +397,7 @@ class Teseo {

} // namespace

// Implementation details, define the templates for the method Iterator#scan()
// Implementation details. It defines the templates for the method Iterator#scan()
#if !defined(_TESEO_INTERNAL)
#include "teseo/interface/iterator.hpp"
#endif
5 changes: 1 addition & 4 deletions include/teseo/context/global_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

namespace teseo::aux { class Cache; } // forward declaration
namespace teseo::aux { class View; } // forward declaration
namespace teseo::context { class ThreadContext; } // forward declaration
namespace teseo::gc { class GarbageCollector; } // forward declaration
namespace teseo::memstore { class Memstore; } // forward declaration
namespace teseo::profiler { class EventGlobal; } // forward declaration
Expand All @@ -37,11 +38,7 @@ namespace teseo::transaction{ class MemoryPoolList; } // forward declaration
namespace teseo::transaction{ class TransactionImpl; } // forward declaration
namespace teseo::transaction{ class TransactionSequence; } // forward declaration


namespace teseo::context {
class GarbageCollector; // forward declaration
class ThreadContext; // forward declaration
class TcTimer; // forward declaration

/**
* A database instance
Expand Down
6 changes: 4 additions & 2 deletions include/teseo/context/thread_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "teseo/transaction/transaction_list.hpp"
#include "teseo/util/latch.hpp"

namespace teseo::context { class GlobalContext; } // forward declaration
namespace teseo::profiler { class EventThread; } // forward declaration
namespace teseo::profiler { class RebalanceList; } // forward declaration
namespace teseo::transaction { class MemoryPool; } // forward declaration
Expand All @@ -34,8 +35,9 @@ namespace teseo::transaction { class TransactionSequence; } // forward declarati

namespace teseo::context {

class GlobalContext; // forward decl.

/**
* The local state associated to a logical thread
*/
class ThreadContext {
friend class GlobalContext;

Expand Down
2 changes: 0 additions & 2 deletions include/teseo/runtime/timer_service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ namespace teseo::runtime { class Runtime; } // forward decl.

namespace teseo::runtime {

class Runtime; // forward declaration

class TimerService {
struct event_base* m_queue; // libevent's queue
runtime::Runtime* const m_runtime; // owner of this instance
Expand Down
2 changes: 1 addition & 1 deletion src/context/tc_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ using namespace std;
namespace teseo::context {

TcList::TcList(GlobalContext* global_context) : m_global_context(global_context), m_list(nullptr), m_size(0), m_capacity(StaticConfiguration::context_tclist_initial_capacity -1){
m_list = (ThreadContext**) calloc(sizeof(ThreadContext*), m_capacity);
m_list = (ThreadContext**) calloc(sizeof(ThreadContext*), m_capacity +1);
if(m_list == nullptr) throw std::bad_alloc{};
}

Expand Down
4 changes: 2 additions & 2 deletions src/runtime/timer_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

#include <cassert>
#include <event2/event.h>
#include <teseo/runtime/queue.hpp>
#include <teseo/runtime/timer_service.hpp>

#include <stdexcept>

#include "teseo/context/global_context.hpp"
Expand All @@ -28,6 +27,7 @@
#include "teseo/gc/garbage_collector.hpp"
#include "teseo/gc/tc_queue.hpp"
#include "teseo/memstore/context.hpp"
#include "teseo/runtime/queue.hpp"
#include "teseo/runtime/runtime.hpp"
#include "teseo/runtime/task.hpp"
#include "teseo/util/chrono.hpp"
Expand Down

0 comments on commit e98c1a6

Please sign in to comment.