From ee23b0204d493ebcf18129b70db12b484e0445bb Mon Sep 17 00:00:00 2001 From: Marko Budiselic <mbudiselicbuda@gmail.com> Date: Sat, 17 Sep 2016 15:31:35 +0100 Subject: [PATCH] comments refactor --- include/query_engine/hardcode/queries.hpp | 5 +++++ include/storage/indexes/impl/unique_ordered_index.hpp | 1 + include/storage/indexes/index_base.hpp | 3 --- include/storage/indexes/index_record_collection.hpp | 2 ++ include/storage/indexes/index_update.hpp | 2 ++ include/storage/indexes/indexes.hpp | 6 ++++++ include/storage/indexes/keys/index_key.hpp | 2 ++ include/storage/indexes/keys/non_unique_key.hpp | 2 ++ include/storage/indexes/keys/unique_key.hpp | 2 ++ include/storage/indexes/sort_order.hpp | 2 ++ include/storage/model/properties/properties.hpp | 3 +++ include/storage/model/properties/property_family.hpp | 1 - include/storage/record_accessor.hpp | 2 +- include/utils/memory/stack_allocator.hpp | 2 ++ include/utils/option.hpp | 8 ++------ 15 files changed, 32 insertions(+), 11 deletions(-) diff --git a/include/query_engine/hardcode/queries.hpp b/include/query_engine/hardcode/queries.hpp index 37704ba9d..eccb605b2 100644 --- a/include/query_engine/hardcode/queries.hpp +++ b/include/query_engine/hardcode/queries.hpp @@ -328,6 +328,7 @@ auto load_queries(Db &db) Option<const VertexAccessor> n; Option<const EdgeAccessor> r; + // lazy load iterator auto it_type = type.index() .for_range(t) .clone_to(r) // Savepoint @@ -346,12 +347,16 @@ auto load_queries(Db &db) if (it_type.count() > it_vertex.count()) { // Going through vertices wiil probably be faster it_vertex.to().for_all([&](auto m) { + // m is changing + // n is n // PRINT n, m }); } else { // Going through edges wiil probably be faster it_type.to().for_all([&](auto m) { + // m is r + // n is changing // PRINT n, m }); } diff --git a/include/storage/indexes/impl/unique_ordered_index.hpp b/include/storage/indexes/impl/unique_ordered_index.hpp index 845321f4e..09a9b22bf 100644 --- a/include/storage/indexes/impl/unique_ordered_index.hpp +++ b/include/storage/indexes/impl/unique_ordered_index.hpp @@ -4,6 +4,7 @@ #include "data_structures/concurrent/concurrent_set.hpp" +// TODO: T shoud be TG (TypeGroup) template <class T, class K> class UniqueOrderedIndex : public IndexBase<T, K> { diff --git a/include/storage/indexes/index_base.hpp b/include/storage/indexes/index_base.hpp index 951c16861..cbe12503a 100644 --- a/include/storage/indexes/index_base.hpp +++ b/include/storage/indexes/index_base.hpp @@ -29,9 +29,6 @@ template <class TG, class K> class IndexBase : public DeleteSensitive { public: - // typedef T value_type; - // typedef K key_type; - // Created with the database IndexBase(IndexDefinition &&it); diff --git a/include/storage/indexes/index_record_collection.hpp b/include/storage/indexes/index_record_collection.hpp index 53d4a1ba3..ff1c071b6 100644 --- a/include/storage/indexes/index_record_collection.hpp +++ b/include/storage/indexes/index_record_collection.hpp @@ -1,5 +1,7 @@ // #pragma once // +// TODO: DEPRICATED +// // #include <memory> // // #include "data_structures/concurrent/concurrent_set.hpp" diff --git a/include/storage/indexes/index_update.hpp b/include/storage/indexes/index_update.hpp index e19650960..dad44023f 100644 --- a/include/storage/indexes/index_update.hpp +++ b/include/storage/indexes/index_update.hpp @@ -16,6 +16,8 @@ struct IndexUpdateVertex Vertex *record; }; +// based of IndexUpdate objects IndexRecords are created +// at the end of transaction (inside commit called on DbAccessor) struct IndexUpdate { enum diff --git a/include/storage/indexes/indexes.hpp b/include/storage/indexes/indexes.hpp index 153d306b0..b4b32ee70 100644 --- a/include/storage/indexes/indexes.hpp +++ b/include/storage/indexes/indexes.hpp @@ -20,7 +20,13 @@ public: // Adds index defined in given definition. Returns true if successfull. bool add_index(IndexDefinition id); + + // currently caller has to get index through object that contains + // the index + + // TODO: redesign // + // this was a nice try // // Returns index from location. // template <class TG, class K> // Option<IndexHolder<TG, K>> get_index(IndexLocation loc) diff --git a/include/storage/indexes/keys/index_key.hpp b/include/storage/indexes/keys/index_key.hpp index b2555a782..0dd847153 100644 --- a/include/storage/indexes/keys/index_key.hpp +++ b/include/storage/indexes/keys/index_key.hpp @@ -1,5 +1,7 @@ #pragma once +// TODO: DEPRICATED + #include "utils/total_ordering.hpp" #include "storage/model/properties/properties.hpp" diff --git a/include/storage/indexes/keys/non_unique_key.hpp b/include/storage/indexes/keys/non_unique_key.hpp index dd64b0264..d64227258 100644 --- a/include/storage/indexes/keys/non_unique_key.hpp +++ b/include/storage/indexes/keys/non_unique_key.hpp @@ -1,5 +1,7 @@ #pragma once +// TODO: DEPRICATED + #include "unique_key.hpp" template <class K, class T, class SortOrder> diff --git a/include/storage/indexes/keys/unique_key.hpp b/include/storage/indexes/keys/unique_key.hpp index d98a48f6c..6c415795c 100644 --- a/include/storage/indexes/keys/unique_key.hpp +++ b/include/storage/indexes/keys/unique_key.hpp @@ -1,5 +1,7 @@ #pragma once +// TODO: DEPRICATED + #include "utils/total_ordering.hpp" #include "storage/indexes/sort_order.hpp" diff --git a/include/storage/indexes/sort_order.hpp b/include/storage/indexes/sort_order.hpp index 5d9348601..b04e942a0 100644 --- a/include/storage/indexes/sort_order.hpp +++ b/include/storage/indexes/sort_order.hpp @@ -1,5 +1,7 @@ #pragma once +// TODO: DEPRICATED + template <class T> struct Ascending { diff --git a/include/storage/model/properties/properties.hpp b/include/storage/model/properties/properties.hpp index a62a1d750..54ea1034a 100644 --- a/include/storage/model/properties/properties.hpp +++ b/include/storage/model/properties/properties.hpp @@ -8,6 +8,9 @@ #include "storage/model/properties/property_family.hpp" #include "storage/model/properties/stored_property.hpp" +// TG - type group (TypeGroupEntity) + +// TODO: think about a better place template <class TG, class T> using type_key_t = typename PropertyFamily<TG>::PropertyType::template PropertyTypeKey<T>; diff --git a/include/storage/model/properties/property_family.hpp b/include/storage/model/properties/property_family.hpp index 4206318a0..72e298cbf 100644 --- a/include/storage/model/properties/property_family.hpp +++ b/include/storage/model/properties/property_family.hpp @@ -34,7 +34,6 @@ public: public: // Ordered on POINTERS to PropertyFamily - // TODO: This probably isn't necessary anymore. class PropertyFamilyKey : public TotalOrdering<PropertyFamilyKey>, public TotalOrdering<PropertyFamilyKey, PropertyFamily>, diff --git a/include/storage/record_accessor.hpp b/include/storage/record_accessor.hpp index cd7193f78..379bbd02e 100644 --- a/include/storage/record_accessor.hpp +++ b/include/storage/record_accessor.hpp @@ -72,7 +72,7 @@ public: if (record->is_visible_write(db.trans)) { // TODO: VALIDATE THIS BRANCH. THEN ONLY THIS TRANSACTION CAN SEE - // THIS DATA WHICH MEENS THAT IT CAN CHANGE IT. + // THIS DATA WHICH MEANS THAT IT CAN CHANGE IT. return Derived(record, vlist, db); } else { diff --git a/include/utils/memory/stack_allocator.hpp b/include/utils/memory/stack_allocator.hpp index ca66aa08c..40b6bf014 100644 --- a/include/utils/memory/stack_allocator.hpp +++ b/include/utils/memory/stack_allocator.hpp @@ -4,6 +4,8 @@ #include "query_engine/exceptions/exceptions.hpp" #include "utils/memory/block_allocator.hpp" +// http://en.cppreference.com/w/cpp/language/new + // Useful for allocating memory which can be freed with one call. // Most performant for data which need to be present to the end. class StackAllocator diff --git a/include/utils/option.hpp b/include/utils/option.hpp index 751c73b03..e6612b2a9 100644 --- a/include/utils/option.hpp +++ b/include/utils/option.hpp @@ -5,17 +5,13 @@ #include <ext/aligned_buffer.h> #include <utility> +// Optional object storage + template <class T> class Option { public: Option() { std::memset(data._M_addr(), 0, sizeof(T)); } - // - // Option(T item) - // { - // new (data._M_addr()) T(std::forward(item)); - // initialized = true; - // } Option(T const &item) {