diff --git a/data_model/data_model.hpp b/data_model/data_model.hpp deleted file mode 100644 index 2dbd054fc..000000000 --- a/data_model/data_model.hpp +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef MEMGRAPH_DATA_MODEL_DATA_MODEL_HPP -#define MEMGRAPH_DATA_MODEL_DATA_MODEL_HPP - -#include "node.hpp" -#include "edge.hpp" - -#endif diff --git a/data_model/edge.hpp b/data_model/edge.hpp deleted file mode 100644 index 9531bbbd2..000000000 --- a/data_model/edge.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef MEMGRAPH_DATA_MODEL_EDGE_HPP -#define MEMGRAPH_DATA_MODEL_EDGE_HPP - -#include "json/all.hpp" -#include "record.hpp" - -struct Node; - -struct Edge : Record -{ - Node* from; - Node* to; - - json::Object* data; -}; - -#endif diff --git a/data_model/graph.hpp b/data_model/graph.hpp deleted file mode 100644 index b74f73ed9..000000000 --- a/data_model/graph.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef MEMGRAPH_DATA_MODEL_GRAPH_HPP -#define MEMGRAPH_DATA_MODEL_GRAPH_HPP - -#include - -#include "node.hpp" -#include "edge.hpp" - -struct Graph -{ -} - -#endif diff --git a/data_model/json/all.hpp b/data_model/json/all.hpp deleted file mode 100644 index d6bf229a4..000000000 --- a/data_model/json/all.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef MEMGRAPH_DATA_MODEL_JSON_ALL_HPP -#define MEMGRAPH_DATA_MODEL_JSON_ALL_HPP - -#include "array.hpp" -#include "bool.hpp" -#include "integral.hpp" -#include "json.hpp" -#include "null.hpp" -#include "object.hpp" -#include "primitive.hpp" -#include "real.hpp" -#include "string.hpp" - -#endif diff --git a/data_model/json/array.hpp b/data_model/json/array.hpp deleted file mode 100644 index 0ec2187f5..000000000 --- a/data_model/json/array.hpp +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef MEMGRAPH_DATA_MODEL_JSON_ARRAY_HPP -#define MEMGRAPH_DATA_MODEL_JSON_ARRAY_HPP - -#include -#include -#include - -#include "utilities/string/intercalate.hpp" - -#include "json.hpp" - -namespace json -{ - -class Array final : public Json -{ -public: - Array() {} - - template - Array(It first, It last) - : elements(first, last) {} - - Array(std::initializer_list elements) - : elements(elements) {} - - virtual bool is_array() const; - - size_t size() const; - - Array& push(const std::shared_ptr& element); - - const spJson& operator[](size_t i) const; - spJson operator[](size_t i); - - virtual operator std::string() const; - -private: - std::vector elements; -}; - -bool Array::is_array() const -{ - return true; -} - -size_t Array::size() const -{ - return elements.size(); -} - -Array& Array::push(const spJson& element) -{ - assert(element); - - elements.push_back(element); - return *this; -} - -const spJson& Array::operator[](size_t i) const -{ - return elements[i]; -} - -spJson Array::operator[](size_t i) -{ - return elements[i]; -} - -Array::operator std::string() const -{ - std::vector xs; - - std::transform(elements.begin(), elements.end(), std::back_inserter(xs), - [](const spJson& element) { - return static_cast(*element); - }); - - return "[" + utils::intercalate(xs.begin(), xs.end(), ",") + "]"; -} - -} - -#endif diff --git a/data_model/json/bool.hpp b/data_model/json/bool.hpp deleted file mode 100644 index 545386062..000000000 --- a/data_model/json/bool.hpp +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef MEMGRAPH_DATA_MODEL_JSON_BOOL_HPP -#define MEMGRAPH_DATA_MODEL_JSON_BOOL_HPP - -#include "primitive.hpp" - -namespace json { - -class Bool final : public Primitive -{ -public: - Bool() {} - - Bool(bool value) - : Primitive(value) {} - - virtual bool is_boolean() const; - - virtual operator std::string() const; -}; - -bool Bool::is_boolean() const -{ - return true; -} - -Bool::operator std::string() const -{ - return value == true ? "true" : "false"; -} - -} - -#endif diff --git a/data_model/json/integral.hpp b/data_model/json/integral.hpp deleted file mode 100644 index 2467f8742..000000000 --- a/data_model/json/integral.hpp +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef MEMGRAPH_DATA_MODEL_JSON_INTEGRAL_HPP -#define MEMGRAPH_DATA_MODEL_JSON_INTEGRAL_HPP - -#include "primitive.hpp" - -namespace json { - -class Integral final : public Primitive -{ -public: - Integral() {} - - Integral(int64_t value) - : Primitive(value) {} - - virtual bool is_integral() const; - - virtual operator std::string() const; -}; - -bool Integral::is_integral() const -{ - return true; -} - -Integral::operator std::string() const -{ - return std::to_string(value); -} - -} - -#endif diff --git a/data_model/json/json.hpp b/data_model/json/json.hpp deleted file mode 100644 index dc9784108..000000000 --- a/data_model/json/json.hpp +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef MEMGRAPH_DATA_MODEL_JSON_JSON_HPP -#define MEMGRAPH_DATA_MODEL_JSON_JSON_HPP - -#include -#include -#include - -namespace json { - -class Json; - -typedef std::shared_ptr spJson; - -class Json -{ -public: - Json() {} - virtual ~Json() {} - - virtual bool is_object() const { return false; } - virtual bool is_array() const { return false; } - virtual bool is_real() const { return false; } - virtual bool is_integral() const { return false; } - virtual bool is_boolean() const { return false; } - virtual bool is_null() const { return false; } - - template T& as(); - template const T& as() const; - - virtual operator std::string() const = 0; -}; - -template -T& Json::as() -{ - return *dynamic_cast(this); -} - -template -const T& Json::as() const -{ - return *dynamic_cast(this); -} - -} - -#endif diff --git a/data_model/json/null.hpp b/data_model/json/null.hpp deleted file mode 100644 index 3a50bf867..000000000 --- a/data_model/json/null.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef MEMGRAPH_DATA_MODEL_JSON_NULL_HPP -#define MEMGRAPH_DATA_MODEL_JSON_NULL_HPP - -#include "json.hpp" - -namespace json { - -class Null final : public Json -{ -public: - Null() {} - - virtual bool is_null() const; - - virtual operator std::string() const; -}; - -bool Null::is_null() const -{ - return true; -} - -Null::operator std::string() const -{ - return "null"; -} - -} - -#endif diff --git a/data_model/json/object.hpp b/data_model/json/object.hpp deleted file mode 100644 index ee7b13ce1..000000000 --- a/data_model/json/object.hpp +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef MEMGRAPH_DATA_MODEL_JSON_OBJECT_HPP -#define MEMGRAPH_DATA_MODEL_JSON_OBJECT_HPP - -#include - -#include -#include -#include -#include -#include - -#include "utilities/string/intercalate.hpp" - -#include "json.hpp" - -namespace json { - -typedef std::pair const_kv_pair_t; -typedef std::pair kv_pair_t; - -class Object; - -typedef std::shared_ptr spObject; - -class Object : public Json -{ -public: - Object() {} - - Object(std::initializer_list elements) - : props(elements) {} - - virtual bool is_object() const; - - const spJson& at(const std::string& key) const; - spJson at(const std::string& key); - - const spJson& operator[](const std::string& key) const; - spJson operator[](const std::string& key); - - Object& put(const std::string& key, spJson value); - - Object& operator<<(const kv_pair_t& kv_pair); - - virtual operator std::string() const; - -protected: - std::map props; -}; - -bool Object::is_object() const -{ - return true; -} - -const spJson& Object::at(const std::string& key) const -{ - return props.at(key); -} - -spJson Object::at(const std::string& key) -{ - return props.at(key); -} - -const spJson& Object::operator[](const std::string& key) const -{ - return this->at(key); -} - -spJson Object::operator[](const std::string& key) -{ - return this->at(key); -} - -Object& Object::put(const std::string& key, spJson value) -{ - assert(value); - - props[key] = value; - return *this; -} - -Object& Object::operator<<(const kv_pair_t& kv_pair) -{ - return this->put(std::get<0>(kv_pair), std::get<1>(kv_pair)); -} - -Object::operator std::string() const -{ - if(props.empty()) - return "{}"; - - std::vector xs; - - std::transform(props.begin(), props.end(), std::back_inserter(xs), - [](const kv_pair_t& kvp) { - return "\"" + kvp.first + "\":" + static_cast(*kvp.second); - }); - - return "{" + utils::intercalate(xs.begin(), xs.end(), ",") + "}"; -} - -} - -#endif diff --git a/data_model/json/primitive.hpp b/data_model/json/primitive.hpp deleted file mode 100644 index cf4a9451b..000000000 --- a/data_model/json/primitive.hpp +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef MEMGRAPH_DATA_MODEL_JSON_PRIMITIVE_HPP -#define MEMGRAPH_DATA_MODEL_JSON_PRIMITIVE_HPP - -#include "json.hpp" - -namespace json { - -template -class Primitive : public Json -{ -public: - Primitive() {} - - Primitive(const T& value) - : value(value) {} - - T get() const { return value; } - void set(T value) { this->value = value; } - - operator T() const { return this->get(); } - -protected: - T value; -}; - - -} - -#endif diff --git a/data_model/json/real.hpp b/data_model/json/real.hpp deleted file mode 100644 index 214b2ba63..000000000 --- a/data_model/json/real.hpp +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef MEMGRAPH_DATA_MODEL_JSON_REAL_HPP -#define MEMGRAPH_DATA_MODEL_JSON_REAL_HPP - -#include "primitive.hpp" - -namespace json { - -class Real final : public Primitive -{ -public: - Real() {} - - Real(float value) - : Primitive(value) {} - - virtual bool is_real() const; - - virtual operator std::string() const; -}; - -bool Real::is_real() const -{ - return true; -} - -Real::operator std::string() const -{ - return std::to_string(value); -} - -} - -#endif diff --git a/data_model/json/string.hpp b/data_model/json/string.hpp deleted file mode 100644 index 842a7399b..000000000 --- a/data_model/json/string.hpp +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef MEMGRAPH_DATA_MODEL_JSON_STRING_HPP -#define MEMGRAPH_DATA_MODEL_JSON_STRING_HPP - -#include "primitive.hpp" - -namespace json -{ - -class String final : public Primitive -{ -public: - String() {} - - String(const std::string& value) - : Primitive(value) {} - - virtual bool is_string() const; - - virtual operator std::string() const; -}; - -bool String::is_string() const -{ - return true; -} - -String::operator std::string() const -{ - return "\"" + value + "\""; -} - -} - -#endif diff --git a/data_model/node.hpp b/data_model/node.hpp deleted file mode 100644 index b797f0026..000000000 --- a/data_model/node.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef MEMGRAPH_DATA_MODEL_NODE_HPP -#define MEMGRAPH_DATA_MODEL_NODE_HPP - -#include - -#include "json/all.hpp" -#include "record.hpp" -#include "edge.hpp" - -struct Node : Record -{ - std::vector in; - std::vector out; - - json::Object* data; -}; - -#endif diff --git a/data_model/record.hpp b/data_model/record.hpp deleted file mode 100644 index cffa519d9..000000000 --- a/data_model/record.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef MEMGRAPH_DATA_MODEL_RECORD_HPP -#define MEMGRAPH_DATA_MODEL_RECORD_HPP - -#include - -class Record -{ - uint64_t id; - - // used by MVCC to keep track of what's visible to transactions - uint64_t xmin, xmax; -}; - -#endif diff --git a/utils/sync/all.hpp b/utils/sync/all.hpp deleted file mode 100644 index 02ac177b2..000000000 --- a/utils/sync/all.hpp +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef MEMGRAPH_UTILS_SYNC_ALL_HPP -#define MEMGRAPH_UTILS_SYNC_ALL_HPP - -#include "spinlock.hpp" - -#endif diff --git a/utils/sync/caslock.hpp b/utils/sync/caslock.hpp deleted file mode 100644 index 3f6f94691..000000000 --- a/utils/sync/caslock.hpp +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef MEMGRAPH_UTILS_SYNC_CASLOCK_HPP -#define MEMGRAPH_UTILS_SYNC_CASLOCK_HPP - -#include - -struct CasLock -{ - uint8_t lock; - - void lock() - { - } - - void unlock() - { - } - -}; - -#endif diff --git a/utils/sync/spinlock.hpp b/utils/sync/spinlock.hpp deleted file mode 100644 index 955cfc737..000000000 --- a/utils/sync/spinlock.hpp +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef MEMGRAPH_UTILS_SYNC_SPINLOCK_HPP -#define MEMGRAPH_UTILS_SYNC_SPINLOCK_HPP - -#include -#include - -class SpinLock -{ -public: - void lock(); - void unlock(); - -private: - // guaranteed by standard to be lock free! - std::atomic_flag lock_flag = ATOMIC_FLAG_INIT; -}; - -void SpinLock::lock() -{ - // TODO add asm pause and counter first before sleeping - // might be faster, but test this and see - while(lock_flag.test_and_set(std::memory_order_acquire)) - usleep(250); -} - -void SpinLock::unlock() -{ - lock_flag.clear(std::memory_order_release); -} - -#endif