memgraph/include/storage/indexes/index.hpp
Kruno Tomola Fabro 5a42e15c4a Alpha version of label indexes.
Squashed messages from 9 commits:

9.
Properties now uses PropertyFamily and contained classes.
Fetching,seting,clearing properties can be done with PropertyFamilyKey or PropertyTypeKey.
Hierarchy of newly added clases is:
Vertices -n-> PropertyFamily {name: String} <-1-n-> PropertyType {type: Property::Flags}
Edges -n-> PropertyFamily {name: String} <-1-n-> PropertyType {type: Property::Flags}

PropertyFamilyKey -> PropertyType
PropertyTypeKey -> PropertyType

PropertyType t0,t1;
let t0!=t1 be true
let t0.family==t1.family be true

then next is true
PropertyTypeKey{&t0}!=PropertyTypeKey{&t1}
PropertyFamilyKey{&t0}==PropertyFamilyKey{&t1}
PropertyFamilyKey{&t0}==PropertyTypeKey{&t1}
PropertyTypeKey{&t0}==PropertyFamilyKey{&t1}

8.
Intermedate commit.
Noticed that integration queries throw SEGFAULT.

7.
Defined interface for indexes.
Fixed three memory leaks.
Fixed integration_queries test which now passes.

6.
Commit which return Xorshift128plus to valid shape.

5.
Tmp commit.

4.
Label Index is compiling.

3.
tmp

2.
Vertex::Accessor now updates Label index.

1.
Applied changes for code review.
2016-08-18 15:34:36 +01:00

45 lines
1.4 KiB
C++

// #pragma once
//
// #include <memory>
//
// #include "data_structures/concurrent/concurrent_map.hpp"
// #include "storage/indexes/index_record.hpp"
// #include "storage/indexes/index_record_collection.hpp"
// #include "storage/label/label.hpp"
//
// template <class Key, class Item>
// class Index
// {
// public:
// using container_t = ConcurrentMap<Key, Item>;
//
// Index() : index(std::make_unique<container_t>()) {}
//
// auto update(const Label &label, VertexIndexRecord &&index_record)
// {
// auto accessor = index->access();
// auto label_ref = label_ref_t(label);
//
// // create Index Record Collection if it doesn't exist
// if (!accessor.contains(label_ref)) {
// accessor.insert(label_ref, std::move(VertexIndexRecordCollection()));
// }
//
// // add Vertex Index Record to the Record Collection
// auto &record_collection = (*accessor.find(label_ref)).second;
// record_collection.add(std::forward<VertexIndexRecord>(index_record));
// }
//
// VertexIndexRecordCollection &find(const Label &label)
// {
// // TODO: accessor should be outside?
// // bacause otherwise GC could delete record that has just be returned
// auto label_ref = label_ref_t(label);
// auto accessor = index->access();
// return (*accessor.find(label_ref)).second;
// }
//
// private:
// std::unique_ptr<container_t> index;
// };