Merge branch 'dev' of https://memgraph.phacility.com/diffusion/MG/memgraph into dev
This commit is contained in:
commit
58b9c45ff2
8
.arclint
Normal file
8
.arclint
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"linters": {
|
||||||
|
"cppcheck": {
|
||||||
|
"type": "cppcheck",
|
||||||
|
"include": ["(\\.cpp$)", "(\\.hpp$)"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
239
CMakeLists.txt
239
CMakeLists.txt
@ -86,6 +86,7 @@ set(fmt_source_dir ${libs_dir}/fmt)
|
|||||||
set(fmt_static_lib ${fmt_source_dir}/fmt/libfmt.a)
|
set(fmt_static_lib ${fmt_source_dir}/fmt/libfmt.a)
|
||||||
# yaml-cpp
|
# yaml-cpp
|
||||||
set(yaml_source_dir ${libs_dir}/yaml-cpp)
|
set(yaml_source_dir ${libs_dir}/yaml-cpp)
|
||||||
|
set(yaml_include_dir ${yaml_source_dir}/include)
|
||||||
set(yaml_static_lib ${yaml_source_dir}/libyaml-cpp.a)
|
set(yaml_static_lib ${yaml_source_dir}/libyaml-cpp.a)
|
||||||
# Catch (C++ Automated Test Cases in Headers)
|
# Catch (C++ Automated Test Cases in Headers)
|
||||||
set(catch_source_dir "${libs_dir}/Catch")
|
set(catch_source_dir "${libs_dir}/Catch")
|
||||||
@ -135,193 +136,31 @@ foreach(source_foler ${source_folders})
|
|||||||
file(COPY ${include_dir}/${source_folder} DESTINATION ${test_include_dir})
|
file(COPY ${include_dir}/${source_folder} DESTINATION ${test_include_dir})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
include(copy_includes)
|
||||||
# COPY header files required by query engine (query compiler)
|
|
||||||
# TODO: somehow automate (in destination dir should be only required include files)
|
|
||||||
FILE(COPY ${include_dir}/barrier/barrier.hpp DESTINATION ${build_include_dir}/barrier)
|
|
||||||
FILE(COPY ${include_dir}/database/db.hpp DESTINATION ${build_include_dir}/database)
|
|
||||||
FILE(COPY ${include_dir}/database/db_transaction.hpp DESTINATION ${build_include_dir}/database)
|
|
||||||
FILE(COPY ${include_dir}/database/db_accessor.hpp DESTINATION ${build_include_dir}/database)
|
|
||||||
|
|
||||||
FILE(COPY ${include_dir}/storage/common.hpp DESTINATION ${build_include_dir}/storage)
|
# linter setup (clang-tidy)
|
||||||
FILE(COPY ${include_dir}/storage/graph.hpp DESTINATION ${build_include_dir}/storage)
|
# all source files for linting
|
||||||
FILE(COPY ${include_dir}/storage/edge.hpp DESTINATION ${build_include_dir}/storage)
|
FILE(GLOB_RECURSE LINTER_SRC_FILES
|
||||||
FILE(COPY ${include_dir}/storage/edge_record.hpp DESTINATION ${build_include_dir}/storage)
|
${src_dir}/*.cpp
|
||||||
FILE(COPY ${include_dir}/storage/vertex_record.hpp DESTINATION ${build_include_dir}/storage)
|
${CMAKE_SOURCE_DIR}/tests/.cpp
|
||||||
FILE(COPY ${include_dir}/storage/edge_accessor.hpp DESTINATION ${build_include_dir}/storage)
|
${CMAKE_SOURCE_DIR}/poc/.cpp
|
||||||
FILE(COPY ${include_dir}/storage/edges.hpp DESTINATION ${build_include_dir}/storage)
|
)
|
||||||
FILE(COPY ${include_dir}/storage/vertices.hpp DESTINATION ${build_include_dir}/storage)
|
MESSAGE(STATUS "All cpp files for linting are: ${LINTER_SRC_FILES}")
|
||||||
FILE(COPY ${include_dir}/storage/vertex.hpp DESTINATION ${build_include_dir}/storage)
|
|
||||||
FILE(COPY ${include_dir}/storage/vertex_accessor.hpp DESTINATION ${build_include_dir}/storage)
|
|
||||||
FILE(COPY ${include_dir}/storage/record_accessor.hpp DESTINATION ${build_include_dir}/storage)
|
|
||||||
FILE(COPY ${include_dir}/storage/locking/record_lock.hpp DESTINATION ${build_include_dir}/storage/locking)
|
|
||||||
FILE(COPY ${include_dir}/storage/locking/lock_status.hpp DESTINATION ${build_include_dir}/storage/locking)
|
|
||||||
FILE(COPY ${include_dir}/storage/edge_type/edge_type_store.hpp DESTINATION ${build_include_dir}/storage/edge_type)
|
|
||||||
FILE(COPY ${include_dir}/storage/edge_type/edge_type.hpp DESTINATION ${build_include_dir}/storage/edge_type)
|
|
||||||
FILE(COPY ${include_dir}/storage/label/label_store.hpp DESTINATION ${build_include_dir}/storage/label)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/edge_map.hpp DESTINATION ${build_include_dir}/storage/model)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/flags.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/stored_property.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/property_holder.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
||||||
FILE(COPY ${include_dir}/storage/type_group_edge.hpp DESTINATION ${build_include_dir}/storage)
|
|
||||||
FILE(COPY ${include_dir}/storage/type_group_vertex.hpp DESTINATION ${build_include_dir}/storage)
|
|
||||||
|
|
||||||
FILE(COPY ${include_dir}/query/util.hpp DESTINATION ${build_include_dir}/query)
|
# linter target clang-tidy
|
||||||
FILE(COPY ${include_dir}/query/i_plan_cpu.hpp DESTINATION ${build_include_dir}/query)
|
find_program(CLANG_TIDY "clang-tidy")
|
||||||
FILE(COPY ${include_dir}/query/strip/stripped.hpp DESTINATION ${build_include_dir}/query/strip)
|
if(CLANG_TIDY)
|
||||||
|
add_custom_target(
|
||||||
FILE(COPY ${include_dir}/data_structures/concurrent/concurrent_map.hpp DESTINATION ${build_include_dir}/data_structures/concurrent)
|
clang-tidy
|
||||||
FILE(COPY ${include_dir}/data_structures/concurrent/concurrent_set.hpp DESTINATION ${build_include_dir}/data_structures/concurrent)
|
COMMAND /usr/bin/clang-tidy
|
||||||
FILE(COPY ${include_dir}/data_structures/concurrent/concurrent_list.hpp DESTINATION ${build_include_dir}/data_structures/concurrent)
|
${LINTER_SRC_FILES}
|
||||||
FILE(COPY ${include_dir}/data_structures/concurrent/common.hpp DESTINATION ${build_include_dir}/data_structures/concurrent)
|
-config=''
|
||||||
FILE(COPY ${include_dir}/data_structures/concurrent/skiplist.hpp DESTINATION ${build_include_dir}/data_structures/concurrent)
|
--
|
||||||
FILE(COPY ${include_dir}/data_structures/concurrent/skiplist_gc.hpp DESTINATION ${build_include_dir}/data_structures/concurrent)
|
-std=c++1y
|
||||||
FILE(COPY ${include_dir}/data_structures/map/rh_hashmultimap.hpp DESTINATION ${build_include_dir}/data_structures/map)
|
-I${CMAKE_SOURCE_DIR}/include -I${fmt_source_dir} -I${yaml_include_dir}
|
||||||
FILE(COPY ${include_dir}/data_structures/map/rh_common.hpp DESTINATION ${build_include_dir}/data_structures/map)
|
)
|
||||||
|
endif()
|
||||||
FILE(COPY ${include_dir}/data_structures/bitset/dynamic_bitset.hpp DESTINATION ${build_include_dir}/data_structures/bitset)
|
# linter setup
|
||||||
|
|
||||||
FILE(COPY ${include_dir}/threading/sync/lockable.hpp DESTINATION ${build_include_dir}/threading/sync)
|
|
||||||
FILE(COPY ${include_dir}/threading/sync/spinlock.hpp DESTINATION ${build_include_dir}/threading/sync)
|
|
||||||
FILE(COPY ${include_dir}/threading/sync/futex.hpp DESTINATION ${build_include_dir}/threading/sync)
|
|
||||||
FILE(COPY ${include_dir}/threading/sync/lock_timeout_error.hpp DESTINATION ${build_include_dir}/threading/sync)
|
|
||||||
|
|
||||||
FILE(COPY ${include_dir}/memory/freelist.hpp DESTINATION ${build_include_dir}/memory)
|
|
||||||
FILE(COPY ${include_dir}/memory/lazy_gc.hpp DESTINATION ${build_include_dir}/garbage)
|
|
||||||
FILE(COPY ${include_dir}/mvcc/cre_exp.hpp DESTINATION ${build_include_dir}/mvcc)
|
|
||||||
FILE(COPY ${include_dir}/mvcc/hints.hpp DESTINATION ${build_include_dir}/mvcc)
|
|
||||||
FILE(COPY ${include_dir}/mvcc/id.hpp DESTINATION ${build_include_dir}/mvcc)
|
|
||||||
FILE(COPY ${include_dir}/mvcc/mvcc_error.hpp DESTINATION ${build_include_dir}/mvcc)
|
|
||||||
FILE(COPY ${include_dir}/mvcc/record.hpp DESTINATION ${build_include_dir}/mvcc)
|
|
||||||
FILE(COPY ${include_dir}/mvcc/serialization_error.hpp DESTINATION ${build_include_dir}/mvcc)
|
|
||||||
FILE(COPY ${include_dir}/mvcc/version.hpp DESTINATION ${build_include_dir}/mvcc)
|
|
||||||
FILE(COPY ${include_dir}/mvcc/version_list.hpp DESTINATION ${build_include_dir}/mvcc)
|
|
||||||
|
|
||||||
FILE(COPY ${include_dir}/transactions/transaction.hpp DESTINATION ${build_include_dir}/transactions)
|
|
||||||
FILE(COPY ${include_dir}/transactions/lock_store.hpp DESTINATION ${build_include_dir}/transactions)
|
|
||||||
FILE(COPY ${include_dir}/transactions/snapshot.hpp DESTINATION ${build_include_dir}/transactions)
|
|
||||||
FILE(COPY ${include_dir}/transactions/commit_log.hpp DESTINATION ${build_include_dir}/transactions)
|
|
||||||
FILE(COPY ${include_dir}/transactions/engine.hpp DESTINATION ${build_include_dir}/transactions)
|
|
||||||
FILE(COPY ${include_dir}/transactions/transaction_store.hpp DESTINATION ${build_include_dir}/transactions)
|
|
||||||
FILE(COPY ${include_dir}/transactions/transaction_read.hpp DESTINATION ${build_include_dir}/transactions)
|
|
||||||
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/properties.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/property.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/traversers/consolewriter.hpp DESTINATION ${build_include_dir}/storage/model/properties/traversers)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/traversers/jsonwriter.hpp DESTINATION ${build_include_dir}/storage/model/properties/traversers)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/all.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/bool.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/null.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/float.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/double.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/int32.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/int64.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/string.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/array.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/floating.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/number.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/integral.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/property_family.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/utils/math_operations.hpp DESTINATION ${build_include_dir}/storage/model/properties/utils)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/utils/unary_negation.hpp DESTINATION ${build_include_dir}/storage/model/properties/utils)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/properties/utils/modulo.hpp DESTINATION ${build_include_dir}/storage/model/properties/utils)
|
|
||||||
|
|
||||||
|
|
||||||
FILE(COPY ${include_dir}/storage/model/edge_model.hpp DESTINATION ${build_include_dir}/storage/model)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/property_model.hpp DESTINATION ${build_include_dir}/storage/model)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/vertex_model.hpp DESTINATION ${build_include_dir}/storage/model)
|
|
||||||
FILE(COPY ${include_dir}/storage/model/edge_list.hpp DESTINATION ${build_include_dir}/storage/model)
|
|
||||||
|
|
||||||
FILE(COPY ${include_dir}/storage/label/label.hpp DESTINATION ${build_include_dir}/storage/label)
|
|
||||||
FILE(COPY ${include_dir}/storage/label/label_collection.hpp DESTINATION ${build_include_dir}/storage/label)
|
|
||||||
FILE(COPY ${include_dir}/storage/label/label_store.hpp DESTINATION ${build_include_dir}/storage/label)
|
|
||||||
|
|
||||||
FILE(COPY ${include_dir}/storage/indexes/index_record.hpp DESTINATION ${build_include_dir}/storage/indexes)
|
|
||||||
FILE(COPY ${include_dir}/storage/indexes/index_base.hpp DESTINATION ${build_include_dir}/storage/indexes)
|
|
||||||
FILE(COPY ${include_dir}/storage/indexes/impl/nonunique_unordered_index.hpp DESTINATION ${build_include_dir}/storage/indexes/impl)
|
|
||||||
FILE(COPY ${include_dir}/storage/indexes/index_holder.hpp DESTINATION ${build_include_dir}/storage/indexes)
|
|
||||||
FILE(COPY ${include_dir}/storage/indexes/index_definition.hpp DESTINATION ${build_include_dir}/storage/indexes)
|
|
||||||
FILE(COPY ${include_dir}/storage/indexes/index_update.hpp DESTINATION ${build_include_dir}/storage/indexes)
|
|
||||||
|
|
||||||
FILE(COPY ${include_dir}/storage/garbage/delete_sensitive.hpp DESTINATION ${build_include_dir}/storage/garbage)
|
|
||||||
FILE(COPY ${include_dir}/storage/garbage/garbage.hpp DESTINATION ${build_include_dir}/storage/garbage)
|
|
||||||
|
|
||||||
FILE(COPY ${include_dir}/utils/sys.hpp DESTINATION ${build_include_dir}/utils)
|
|
||||||
FILE(COPY ${include_dir}/utils/char_str.hpp DESTINATION ${build_include_dir}/utils)
|
|
||||||
FILE(COPY ${include_dir}/utils/void.hpp DESTINATION ${build_include_dir}/utils)
|
|
||||||
FILE(COPY ${include_dir}/utils/array_store.hpp DESTINATION ${build_include_dir}/utils)
|
|
||||||
FILE(COPY ${include_dir}/utils/bswap.hpp DESTINATION ${build_include_dir}/utils)
|
|
||||||
FILE(COPY ${include_dir}/utils/stacktrace.hpp DESTINATION ${build_include_dir}/utils)
|
|
||||||
FILE(COPY ${include_dir}/utils/auto_scope.hpp DESTINATION ${build_include_dir}/utils)
|
|
||||||
FILE(COPY ${include_dir}/utils/assert.hpp DESTINATION ${build_include_dir}/utils)
|
|
||||||
FILE(COPY ${include_dir}/utils/reference_wrapper.hpp DESTINATION ${build_include_dir}/utils)
|
|
||||||
FILE(COPY ${include_dir}/utils/underlying_cast.hpp DESTINATION ${build_include_dir}/utils)
|
|
||||||
FILE(COPY ${include_dir}/utils/total_ordering.hpp DESTINATION ${build_include_dir}/utils)
|
|
||||||
FILE(COPY ${include_dir}/utils/crtp.hpp DESTINATION ${build_include_dir}/utils)
|
|
||||||
FILE(COPY ${include_dir}/utils/placeholder.hpp DESTINATION ${build_include_dir}/utils)
|
|
||||||
FILE(COPY ${include_dir}/utils/likely.hpp DESTINATION ${build_include_dir}/utils)
|
|
||||||
FILE(COPY ${include_dir}/utils/cpu_relax.hpp DESTINATION ${build_include_dir}/utils)
|
|
||||||
FILE(COPY ${include_dir}/utils/counters/atomic_counter.hpp DESTINATION ${build_include_dir}/utils/counters)
|
|
||||||
FILE(COPY ${include_dir}/utils/counters/simple_counter.hpp DESTINATION ${build_include_dir}/utils/counters)
|
|
||||||
FILE(COPY ${include_dir}/utils/random/fast_binomial.hpp DESTINATION ${build_include_dir}/utils/random)
|
|
||||||
FILE(COPY ${include_dir}/utils/random/xorshift128plus.hpp DESTINATION ${build_include_dir}/utils/random)
|
|
||||||
FILE(COPY ${include_dir}/utils/exceptions/basic_exception.hpp DESTINATION ${build_include_dir}/utils/exceptions)
|
|
||||||
FILE(COPY ${include_dir}/utils/datetime/timestamp.hpp DESTINATION ${build_include_dir}/utils/datetime)
|
|
||||||
FILE(COPY ${include_dir}/utils/datetime/datetime_error.hpp DESTINATION ${build_include_dir}/utils/datetime)
|
|
||||||
FILE(COPY ${include_dir}/utils/types/byte.hpp DESTINATION ${build_include_dir}/utils/types)
|
|
||||||
FILE(COPY ${include_dir}/utils/option_ptr.hpp DESTINATION ${build_include_dir}/utils)
|
|
||||||
FILE(COPY ${include_dir}/utils/option.hpp DESTINATION ${build_include_dir}/utils)
|
|
||||||
FILE(COPY ${include_dir}/utils/border.hpp DESTINATION ${build_include_dir}/utils)
|
|
||||||
FILE(COPY ${include_dir}/utils/order.hpp DESTINATION ${build_include_dir}/utils)
|
|
||||||
FILE(COPY ${include_dir}/utils/numerics/saturate.hpp DESTINATION ${build_include_dir}/utils/numerics)
|
|
||||||
|
|
||||||
FILE(COPY ${include_dir}/utils/iterator/iterator_base.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
|
||||||
FILE(COPY ${include_dir}/utils/iterator/virtual_iter.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
|
||||||
FILE(COPY ${include_dir}/utils/iterator/iterator.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
|
||||||
FILE(COPY ${include_dir}/utils/iterator/composable.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
|
||||||
FILE(COPY ${include_dir}/utils/iterator/count.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
|
||||||
FILE(COPY ${include_dir}/utils/iterator/accessor.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
|
||||||
FILE(COPY ${include_dir}/utils/iterator/combined.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
|
||||||
FILE(COPY ${include_dir}/utils/iterator/count.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
|
||||||
FILE(COPY ${include_dir}/utils/iterator/filter.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
|
||||||
FILE(COPY ${include_dir}/utils/iterator/flat_map.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
|
||||||
FILE(COPY ${include_dir}/utils/iterator/for_all.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
|
||||||
FILE(COPY ${include_dir}/utils/iterator/inspect.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
|
||||||
FILE(COPY ${include_dir}/utils/iterator/iterator_accessor.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
|
||||||
FILE(COPY ${include_dir}/utils/iterator/lambda_iterator.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
|
||||||
FILE(COPY ${include_dir}/utils/iterator/limited_map.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
|
||||||
FILE(COPY ${include_dir}/utils/iterator/map.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
|
||||||
FILE(COPY ${include_dir}/utils/iterator/range_iterator.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
|
||||||
|
|
||||||
FILE(COPY ${include_dir}/communication/communication.hpp DESTINATION ${build_include_dir}/communication)
|
|
||||||
FILE(COPY ${include_dir}/communication/bolt/v1/config.hpp DESTINATION ${build_include_dir}/communication/bolt/v1)
|
|
||||||
FILE(COPY ${include_dir}/communication/bolt/v1/serialization/record_stream.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/serialization)
|
|
||||||
FILE(COPY ${include_dir}/communication/bolt/v1/serialization/bolt_serializer.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/serialization)
|
|
||||||
FILE(COPY ${include_dir}/communication/bolt/v1/transport/bolt_encoder.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/transport)
|
|
||||||
FILE(COPY ${include_dir}/communication/bolt/v1/transport/chunked_buffer.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/transport)
|
|
||||||
FILE(COPY ${include_dir}/communication/bolt/v1/transport/chunked_encoder.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/transport)
|
|
||||||
FILE(COPY ${include_dir}/communication/bolt/v1/transport/socket_stream.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/transport)
|
|
||||||
FILE(COPY ${include_dir}/communication/bolt/v1/transport/stream_error.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/transport)
|
|
||||||
FILE(COPY ${include_dir}/communication/bolt/v1/packing/codes.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/packing)
|
|
||||||
FILE(COPY ${include_dir}/communication/bolt/v1/messaging/codes.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/messaging)
|
|
||||||
|
|
||||||
FILE(COPY ${include_dir}/io/network/socket.hpp DESTINATION ${build_include_dir}/io/network)
|
|
||||||
FILE(COPY ${include_dir}/io/network/addrinfo.hpp DESTINATION ${build_include_dir}/io/network)
|
|
||||||
FILE(COPY ${include_dir}/io/network/network_error.hpp DESTINATION ${build_include_dir}/io/network)
|
|
||||||
FILE(COPY ${include_dir}/io/network/socket.hpp DESTINATION ${build_include_dir}/io/network)
|
|
||||||
|
|
||||||
FILE(COPY ${include_dir}/logging/default.hpp DESTINATION ${build_include_dir}/logging)
|
|
||||||
FILE(COPY ${include_dir}/logging/log.hpp DESTINATION ${build_include_dir}/logging)
|
|
||||||
FILE(COPY ${include_dir}/logging/logger.hpp DESTINATION ${build_include_dir}/logging)
|
|
||||||
FILE(COPY ${include_dir}/logging/levels.hpp DESTINATION ${build_include_dir}/logging)
|
|
||||||
|
|
||||||
FILE(COPY ${include_dir}/snapshot/snapshot_engine.hpp DESTINATION ${build_include_dir}/snapshot)
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# add all cpp file recursive into sourceFiles varibale
|
|
||||||
# FILE(GLOB_RECURSE sourceFiles ${src_dir}/*.cpp)
|
|
||||||
# print list of source files
|
|
||||||
# MESSAGE(STATUS "All source files are: ${sourceFiles}")
|
|
||||||
|
|
||||||
# debug flags
|
# debug flags
|
||||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
@ -418,16 +257,6 @@ message(STATUS "TESTS binaries: ${TESTS}")
|
|||||||
option(BENCHMARK "Build benchmark binaries" ON)
|
option(BENCHMARK "Build benchmark binaries" ON)
|
||||||
message(STATUS "BENCHMARK binaries: ${BENCHMARK}")
|
message(STATUS "BENCHMARK binaries: ${BENCHMARK}")
|
||||||
# -- binaries -----------------------------------------------------------------
|
# -- binaries -----------------------------------------------------------------
|
||||||
# -- barrier - this is the way how the engine is isolated so it can be shipped
|
|
||||||
# wherever, the code is completely hidden behind the barrier, during the
|
|
||||||
# development the barrier can be turned off because it is much easier to
|
|
||||||
# debug
|
|
||||||
option(BARRIER "Barrier" ON)
|
|
||||||
message(STATUS "BARRIER: ${BARRIER} (Source code isolation)")
|
|
||||||
if(BARRIER)
|
|
||||||
add_definitions( -DBARRIER )
|
|
||||||
endif()
|
|
||||||
# -- barrier ------------------------------------------------------------------
|
|
||||||
# -- configure defines --------------------------------------------------------
|
# -- configure defines --------------------------------------------------------
|
||||||
|
|
||||||
# -- includes -----------------------------------------------------------------
|
# -- includes -----------------------------------------------------------------
|
||||||
@ -435,7 +264,7 @@ include_directories(${CMAKE_SOURCE_DIR}/include)
|
|||||||
include_directories(${src_dir})
|
include_directories(${src_dir})
|
||||||
include_directories(${build_include_dir})
|
include_directories(${build_include_dir})
|
||||||
include_directories(${fmt_source_dir})
|
include_directories(${fmt_source_dir})
|
||||||
include_directories(${yaml_source_dir}/include)
|
include_directories(${yaml_include_dir})
|
||||||
include_directories(${http_parser_source_dir})
|
include_directories(${http_parser_source_dir})
|
||||||
include_directories(${lexertl_dir})
|
include_directories(${lexertl_dir})
|
||||||
include_directories(${libuv_source_dir}/include)
|
include_directories(${libuv_source_dir}/include)
|
||||||
@ -461,7 +290,6 @@ set(memgraph_src_files
|
|||||||
${src_dir}/utils/string/join.cpp
|
${src_dir}/utils/string/join.cpp
|
||||||
${src_dir}/utils/string/file.cpp
|
${src_dir}/utils/string/file.cpp
|
||||||
${src_dir}/utils/numerics/saturate.cpp
|
${src_dir}/utils/numerics/saturate.cpp
|
||||||
${src_dir}/query_engine/util.cpp
|
|
||||||
${src_dir}/communication/bolt/v1/bolt.cpp
|
${src_dir}/communication/bolt/v1/bolt.cpp
|
||||||
${src_dir}/communication/bolt/v1/states.cpp
|
${src_dir}/communication/bolt/v1/states.cpp
|
||||||
${src_dir}/communication/bolt/v1/session.cpp
|
${src_dir}/communication/bolt/v1/session.cpp
|
||||||
@ -483,6 +311,7 @@ set(memgraph_src_files
|
|||||||
${src_dir}/storage/label/label.cpp
|
${src_dir}/storage/label/label.cpp
|
||||||
${src_dir}/storage/label/label_collection.cpp
|
${src_dir}/storage/label/label_collection.cpp
|
||||||
${src_dir}/storage/label/label_store.cpp
|
${src_dir}/storage/label/label_store.cpp
|
||||||
|
${src_dir}/storage/label/labels_writer.cpp
|
||||||
${src_dir}/storage/edge_type/edge_type.cpp
|
${src_dir}/storage/edge_type/edge_type.cpp
|
||||||
${src_dir}/storage/edge_type/edge_type_store.cpp
|
${src_dir}/storage/edge_type/edge_type_store.cpp
|
||||||
${src_dir}/storage/model/properties/null.cpp
|
${src_dir}/storage/model/properties/null.cpp
|
||||||
@ -532,15 +361,6 @@ add_library(memgraph STATIC ${memgraph_src_files})
|
|||||||
add_library(memgraph_pic STATIC ${memgraph_src_files})
|
add_library(memgraph_pic STATIC ${memgraph_src_files})
|
||||||
set_property(TARGET memgraph_pic PROPERTY POSITION_INDEPENDENT_CODE TRUE)
|
set_property(TARGET memgraph_pic PROPERTY POSITION_INDEPENDENT_CODE TRUE)
|
||||||
|
|
||||||
if (BARRIER)
|
|
||||||
# create static barrier lib
|
|
||||||
add_library(barrier STATIC ${memgraph_src_files})
|
|
||||||
|
|
||||||
# create pic static barrier lib
|
|
||||||
add_library(barrier_pic STATIC ${memgraph_src_files})
|
|
||||||
set_property(TARGET barrier_pic PROPERTY POSITION_INDEPENDENT_CODE TRUE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# tests
|
# tests
|
||||||
if (TESTS)
|
if (TESTS)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
@ -584,12 +404,7 @@ message(STATUS "Release flags: ${CMAKE_CXX_FLAGS_RELEASE}")
|
|||||||
if (MEMGRAPH)
|
if (MEMGRAPH)
|
||||||
add_executable(${MEMGRAPH_BUILD_NAME} ${src_dir}/memgraph_bolt.cpp)
|
add_executable(${MEMGRAPH_BUILD_NAME} ${src_dir}/memgraph_bolt.cpp)
|
||||||
|
|
||||||
if (BARRIER)
|
target_link_libraries(${MEMGRAPH_BUILD_NAME} memgraph)
|
||||||
target_link_libraries(${MEMGRAPH_BUILD_NAME} barrier)
|
|
||||||
elseif (NOT BARRIER)
|
|
||||||
target_link_libraries(${MEMGRAPH_BUILD_NAME} memgraph)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
target_link_libraries(${MEMGRAPH_BUILD_NAME} stdc++fs)
|
target_link_libraries(${MEMGRAPH_BUILD_NAME} stdc++fs)
|
||||||
target_link_libraries(${MEMGRAPH_BUILD_NAME} Threads::Threads)
|
target_link_libraries(${MEMGRAPH_BUILD_NAME} Threads::Threads)
|
||||||
target_link_libraries(${MEMGRAPH_BUILD_NAME} cypher_lib)
|
target_link_libraries(${MEMGRAPH_BUILD_NAME} cypher_lib)
|
||||||
|
187
cmake/copy_includes.cmake
Normal file
187
cmake/copy_includes.cmake
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# COPY header files required by query engine (query compiler)
|
||||||
|
# TODO: create a copy function, COPY_RELATIVE(base relative_path dst)
|
||||||
|
# TODO: somehow automate (in destination dir should be only required include files)
|
||||||
|
FILE(COPY ${include_dir}/database/db.hpp DESTINATION ${build_include_dir}/database)
|
||||||
|
FILE(COPY ${include_dir}/database/db_transaction.hpp DESTINATION ${build_include_dir}/database)
|
||||||
|
FILE(COPY ${include_dir}/database/db_accessor.hpp DESTINATION ${build_include_dir}/database)
|
||||||
|
|
||||||
|
FILE(COPY ${include_dir}/storage/common.hpp DESTINATION ${build_include_dir}/storage)
|
||||||
|
FILE(COPY ${include_dir}/storage/graph.hpp DESTINATION ${build_include_dir}/storage)
|
||||||
|
FILE(COPY ${include_dir}/storage/edge.hpp DESTINATION ${build_include_dir}/storage)
|
||||||
|
FILE(COPY ${include_dir}/storage/edge_record.hpp DESTINATION ${build_include_dir}/storage)
|
||||||
|
FILE(COPY ${include_dir}/storage/vertex_record.hpp DESTINATION ${build_include_dir}/storage)
|
||||||
|
FILE(COPY ${include_dir}/storage/edge_accessor.hpp DESTINATION ${build_include_dir}/storage)
|
||||||
|
FILE(COPY ${include_dir}/storage/edges.hpp DESTINATION ${build_include_dir}/storage)
|
||||||
|
FILE(COPY ${include_dir}/storage/vertices.hpp DESTINATION ${build_include_dir}/storage)
|
||||||
|
FILE(COPY ${include_dir}/storage/vertex.hpp DESTINATION ${build_include_dir}/storage)
|
||||||
|
FILE(COPY ${include_dir}/storage/vertex_accessor.hpp DESTINATION ${build_include_dir}/storage)
|
||||||
|
FILE(COPY ${include_dir}/storage/record_accessor.hpp DESTINATION ${build_include_dir}/storage)
|
||||||
|
FILE(COPY ${include_dir}/storage/locking/record_lock.hpp DESTINATION ${build_include_dir}/storage/locking)
|
||||||
|
FILE(COPY ${include_dir}/storage/locking/lock_status.hpp DESTINATION ${build_include_dir}/storage/locking)
|
||||||
|
FILE(COPY ${include_dir}/storage/edge_type/edge_type_store.hpp DESTINATION ${build_include_dir}/storage/edge_type)
|
||||||
|
FILE(COPY ${include_dir}/storage/edge_type/edge_type.hpp DESTINATION ${build_include_dir}/storage/edge_type)
|
||||||
|
FILE(COPY ${include_dir}/storage/label/label_store.hpp DESTINATION ${build_include_dir}/storage/label)
|
||||||
|
FILE(COPY ${include_dir}/storage/label/labels_writer.hpp DESTINATION ${build_include_dir}/storage/label)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/edge_map.hpp DESTINATION ${build_include_dir}/storage/model)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/flags.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/stored_property.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/property_holder.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
||||||
|
FILE(COPY ${include_dir}/storage/type_group_edge.hpp DESTINATION ${build_include_dir}/storage)
|
||||||
|
FILE(COPY ${include_dir}/storage/type_group_vertex.hpp DESTINATION ${build_include_dir}/storage)
|
||||||
|
FILE(COPY ${include_dir}/storage/edge_x_vertex.hpp DESTINATION ${build_include_dir}/storage)
|
||||||
|
|
||||||
|
FILE(COPY ${include_dir}/query/util.hpp DESTINATION ${build_include_dir}/query)
|
||||||
|
FILE(COPY ${include_dir}/query/i_plan_cpu.hpp DESTINATION ${build_include_dir}/query)
|
||||||
|
FILE(COPY ${include_dir}/query/strip/stripped.hpp DESTINATION ${build_include_dir}/query/strip)
|
||||||
|
|
||||||
|
FILE(COPY ${include_dir}/data_structures/concurrent/concurrent_map.hpp DESTINATION ${build_include_dir}/data_structures/concurrent)
|
||||||
|
FILE(COPY ${include_dir}/data_structures/concurrent/concurrent_set.hpp DESTINATION ${build_include_dir}/data_structures/concurrent)
|
||||||
|
FILE(COPY ${include_dir}/data_structures/concurrent/concurrent_list.hpp DESTINATION ${build_include_dir}/data_structures/concurrent)
|
||||||
|
FILE(COPY ${include_dir}/data_structures/concurrent/common.hpp DESTINATION ${build_include_dir}/data_structures/concurrent)
|
||||||
|
FILE(COPY ${include_dir}/data_structures/concurrent/skiplist.hpp DESTINATION ${build_include_dir}/data_structures/concurrent)
|
||||||
|
FILE(COPY ${include_dir}/data_structures/concurrent/skiplist_gc.hpp DESTINATION ${build_include_dir}/data_structures/concurrent)
|
||||||
|
FILE(COPY ${include_dir}/data_structures/map/rh_hashmultimap.hpp DESTINATION ${build_include_dir}/data_structures/map)
|
||||||
|
FILE(COPY ${include_dir}/data_structures/map/rh_common.hpp DESTINATION ${build_include_dir}/data_structures/map)
|
||||||
|
|
||||||
|
FILE(COPY ${include_dir}/data_structures/bitset/dynamic_bitset.hpp DESTINATION ${build_include_dir}/data_structures/bitset)
|
||||||
|
|
||||||
|
FILE(COPY ${include_dir}/threading/sync/lockable.hpp DESTINATION ${build_include_dir}/threading/sync)
|
||||||
|
FILE(COPY ${include_dir}/threading/sync/spinlock.hpp DESTINATION ${build_include_dir}/threading/sync)
|
||||||
|
FILE(COPY ${include_dir}/threading/sync/futex.hpp DESTINATION ${build_include_dir}/threading/sync)
|
||||||
|
FILE(COPY ${include_dir}/threading/sync/lock_timeout_error.hpp DESTINATION ${build_include_dir}/threading/sync)
|
||||||
|
|
||||||
|
FILE(COPY ${include_dir}/memory/freelist.hpp DESTINATION ${build_include_dir}/memory)
|
||||||
|
FILE(COPY ${include_dir}/memory/lazy_gc.hpp DESTINATION ${build_include_dir}/memory)
|
||||||
|
|
||||||
|
FILE(COPY ${include_dir}/mvcc/cre_exp.hpp DESTINATION ${build_include_dir}/mvcc)
|
||||||
|
FILE(COPY ${include_dir}/mvcc/hints.hpp DESTINATION ${build_include_dir}/mvcc)
|
||||||
|
FILE(COPY ${include_dir}/mvcc/id.hpp DESTINATION ${build_include_dir}/mvcc)
|
||||||
|
FILE(COPY ${include_dir}/mvcc/mvcc_error.hpp DESTINATION ${build_include_dir}/mvcc)
|
||||||
|
FILE(COPY ${include_dir}/mvcc/record.hpp DESTINATION ${build_include_dir}/mvcc)
|
||||||
|
FILE(COPY ${include_dir}/mvcc/serialization_error.hpp DESTINATION ${build_include_dir}/mvcc)
|
||||||
|
FILE(COPY ${include_dir}/mvcc/version.hpp DESTINATION ${build_include_dir}/mvcc)
|
||||||
|
FILE(COPY ${include_dir}/mvcc/version_list.hpp DESTINATION ${build_include_dir}/mvcc)
|
||||||
|
|
||||||
|
FILE(COPY ${include_dir}/transactions/transaction.hpp DESTINATION ${build_include_dir}/transactions)
|
||||||
|
FILE(COPY ${include_dir}/transactions/lock_store.hpp DESTINATION ${build_include_dir}/transactions)
|
||||||
|
FILE(COPY ${include_dir}/transactions/snapshot.hpp DESTINATION ${build_include_dir}/transactions)
|
||||||
|
FILE(COPY ${include_dir}/transactions/commit_log.hpp DESTINATION ${build_include_dir}/transactions)
|
||||||
|
FILE(COPY ${include_dir}/transactions/engine.hpp DESTINATION ${build_include_dir}/transactions)
|
||||||
|
FILE(COPY ${include_dir}/transactions/transaction_store.hpp DESTINATION ${build_include_dir}/transactions)
|
||||||
|
FILE(COPY ${include_dir}/transactions/transaction_read.hpp DESTINATION ${build_include_dir}/transactions)
|
||||||
|
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/properties.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/property.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/json_writer.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/all.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/bool.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/null.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/float.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/double.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/int32.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/int64.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/string.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/array.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/floating.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/number.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/integral.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/property_family.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/utils/math_operations.hpp DESTINATION ${build_include_dir}/storage/model/properties/utils)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/utils/unary_negation.hpp DESTINATION ${build_include_dir}/storage/model/properties/utils)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/properties/utils/modulo.hpp DESTINATION ${build_include_dir}/storage/model/properties/utils)
|
||||||
|
|
||||||
|
|
||||||
|
FILE(COPY ${include_dir}/storage/model/edge_model.hpp DESTINATION ${build_include_dir}/storage/model)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/property_model.hpp DESTINATION ${build_include_dir}/storage/model)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/vertex_model.hpp DESTINATION ${build_include_dir}/storage/model)
|
||||||
|
FILE(COPY ${include_dir}/storage/model/edge_list.hpp DESTINATION ${build_include_dir}/storage/model)
|
||||||
|
|
||||||
|
FILE(COPY ${include_dir}/storage/label/label.hpp DESTINATION ${build_include_dir}/storage/label)
|
||||||
|
FILE(COPY ${include_dir}/storage/label/label_collection.hpp DESTINATION ${build_include_dir}/storage/label)
|
||||||
|
FILE(COPY ${include_dir}/storage/label/label_store.hpp DESTINATION ${build_include_dir}/storage/label)
|
||||||
|
|
||||||
|
FILE(COPY ${include_dir}/storage/indexes/index_record.hpp DESTINATION ${build_include_dir}/storage/indexes)
|
||||||
|
FILE(COPY ${include_dir}/storage/indexes/index_base.hpp DESTINATION ${build_include_dir}/storage/indexes)
|
||||||
|
FILE(COPY ${include_dir}/storage/indexes/impl/nonunique_unordered_index.hpp DESTINATION ${build_include_dir}/storage/indexes/impl)
|
||||||
|
FILE(COPY ${include_dir}/storage/indexes/index_holder.hpp DESTINATION ${build_include_dir}/storage/indexes)
|
||||||
|
FILE(COPY ${include_dir}/storage/indexes/index_definition.hpp DESTINATION ${build_include_dir}/storage/indexes)
|
||||||
|
FILE(COPY ${include_dir}/storage/indexes/index_update.hpp DESTINATION ${build_include_dir}/storage/indexes)
|
||||||
|
|
||||||
|
FILE(COPY ${include_dir}/storage/garbage/delete_sensitive.hpp DESTINATION ${build_include_dir}/storage/garbage)
|
||||||
|
FILE(COPY ${include_dir}/storage/garbage/garbage.hpp DESTINATION ${build_include_dir}/storage/garbage)
|
||||||
|
|
||||||
|
FILE(COPY ${include_dir}/utils/string_buffer.hpp DESTINATION ${build_include_dir}/utils)
|
||||||
|
FILE(COPY ${include_dir}/utils/handle_write.hpp DESTINATION ${build_include_dir}/utils)
|
||||||
|
FILE(COPY ${include_dir}/utils/sys.hpp DESTINATION ${build_include_dir}/utils)
|
||||||
|
FILE(COPY ${include_dir}/utils/char_str.hpp DESTINATION ${build_include_dir}/utils)
|
||||||
|
FILE(COPY ${include_dir}/utils/void.hpp DESTINATION ${build_include_dir}/utils)
|
||||||
|
FILE(COPY ${include_dir}/utils/array_store.hpp DESTINATION ${build_include_dir}/utils)
|
||||||
|
FILE(COPY ${include_dir}/utils/bswap.hpp DESTINATION ${build_include_dir}/utils)
|
||||||
|
FILE(COPY ${include_dir}/utils/stacktrace.hpp DESTINATION ${build_include_dir}/utils)
|
||||||
|
FILE(COPY ${include_dir}/utils/auto_scope.hpp DESTINATION ${build_include_dir}/utils)
|
||||||
|
FILE(COPY ${include_dir}/utils/assert.hpp DESTINATION ${build_include_dir}/utils)
|
||||||
|
FILE(COPY ${include_dir}/utils/reference_wrapper.hpp DESTINATION ${build_include_dir}/utils)
|
||||||
|
FILE(COPY ${include_dir}/utils/underlying_cast.hpp DESTINATION ${build_include_dir}/utils)
|
||||||
|
FILE(COPY ${include_dir}/utils/total_ordering.hpp DESTINATION ${build_include_dir}/utils)
|
||||||
|
FILE(COPY ${include_dir}/utils/crtp.hpp DESTINATION ${build_include_dir}/utils)
|
||||||
|
FILE(COPY ${include_dir}/utils/placeholder.hpp DESTINATION ${build_include_dir}/utils)
|
||||||
|
FILE(COPY ${include_dir}/utils/likely.hpp DESTINATION ${build_include_dir}/utils)
|
||||||
|
FILE(COPY ${include_dir}/utils/cpu_relax.hpp DESTINATION ${build_include_dir}/utils)
|
||||||
|
FILE(COPY ${include_dir}/utils/counters/atomic_counter.hpp DESTINATION ${build_include_dir}/utils/counters)
|
||||||
|
FILE(COPY ${include_dir}/utils/counters/simple_counter.hpp DESTINATION ${build_include_dir}/utils/counters)
|
||||||
|
FILE(COPY ${include_dir}/utils/random/fast_binomial.hpp DESTINATION ${build_include_dir}/utils/random)
|
||||||
|
FILE(COPY ${include_dir}/utils/random/xorshift128plus.hpp DESTINATION ${build_include_dir}/utils/random)
|
||||||
|
FILE(COPY ${include_dir}/utils/exceptions/basic_exception.hpp DESTINATION ${build_include_dir}/utils/exceptions)
|
||||||
|
FILE(COPY ${include_dir}/utils/datetime/timestamp.hpp DESTINATION ${build_include_dir}/utils/datetime)
|
||||||
|
FILE(COPY ${include_dir}/utils/datetime/datetime_error.hpp DESTINATION ${build_include_dir}/utils/datetime)
|
||||||
|
FILE(COPY ${include_dir}/utils/types/byte.hpp DESTINATION ${build_include_dir}/utils/types)
|
||||||
|
FILE(COPY ${include_dir}/utils/option_ptr.hpp DESTINATION ${build_include_dir}/utils)
|
||||||
|
FILE(COPY ${include_dir}/utils/option.hpp DESTINATION ${build_include_dir}/utils)
|
||||||
|
FILE(COPY ${include_dir}/utils/border.hpp DESTINATION ${build_include_dir}/utils)
|
||||||
|
FILE(COPY ${include_dir}/utils/order.hpp DESTINATION ${build_include_dir}/utils)
|
||||||
|
FILE(COPY ${include_dir}/utils/numerics/saturate.hpp DESTINATION ${build_include_dir}/utils/numerics)
|
||||||
|
|
||||||
|
FILE(COPY ${include_dir}/utils/iterator/iterator_base.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
||||||
|
FILE(COPY ${include_dir}/utils/iterator/virtual_iter.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
||||||
|
FILE(COPY ${include_dir}/utils/iterator/iterator.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
||||||
|
FILE(COPY ${include_dir}/utils/iterator/composable.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
||||||
|
FILE(COPY ${include_dir}/utils/iterator/count.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
||||||
|
FILE(COPY ${include_dir}/utils/iterator/accessor.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
||||||
|
FILE(COPY ${include_dir}/utils/iterator/combined.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
||||||
|
FILE(COPY ${include_dir}/utils/iterator/count.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
||||||
|
FILE(COPY ${include_dir}/utils/iterator/filter.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
||||||
|
FILE(COPY ${include_dir}/utils/iterator/flat_map.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
||||||
|
FILE(COPY ${include_dir}/utils/iterator/for_all.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
||||||
|
FILE(COPY ${include_dir}/utils/iterator/inspect.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
||||||
|
FILE(COPY ${include_dir}/utils/iterator/iterator_accessor.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
||||||
|
FILE(COPY ${include_dir}/utils/iterator/lambda_iterator.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
||||||
|
FILE(COPY ${include_dir}/utils/iterator/limited_map.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
||||||
|
FILE(COPY ${include_dir}/utils/iterator/map.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
||||||
|
FILE(COPY ${include_dir}/utils/iterator/range_iterator.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
||||||
|
|
||||||
|
FILE(COPY ${include_dir}/communication/communication.hpp DESTINATION ${build_include_dir}/communication)
|
||||||
|
FILE(COPY ${include_dir}/communication/bolt/v1/config.hpp DESTINATION ${build_include_dir}/communication/bolt/v1)
|
||||||
|
FILE(COPY ${include_dir}/communication/bolt/v1/serialization/record_stream.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/serialization)
|
||||||
|
FILE(COPY ${include_dir}/communication/bolt/v1/serialization/bolt_serializer.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/serialization)
|
||||||
|
FILE(COPY ${include_dir}/communication/bolt/v1/transport/bolt_encoder.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/transport)
|
||||||
|
FILE(COPY ${include_dir}/communication/bolt/v1/transport/chunked_buffer.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/transport)
|
||||||
|
FILE(COPY ${include_dir}/communication/bolt/v1/transport/chunked_encoder.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/transport)
|
||||||
|
FILE(COPY ${include_dir}/communication/bolt/v1/transport/socket_stream.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/transport)
|
||||||
|
FILE(COPY ${include_dir}/communication/bolt/v1/transport/stream_error.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/transport)
|
||||||
|
FILE(COPY ${include_dir}/communication/bolt/v1/packing/codes.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/packing)
|
||||||
|
FILE(COPY ${include_dir}/communication/bolt/v1/messaging/codes.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/messaging)
|
||||||
|
|
||||||
|
FILE(COPY ${include_dir}/io/network/socket.hpp DESTINATION ${build_include_dir}/io/network)
|
||||||
|
FILE(COPY ${include_dir}/io/network/addrinfo.hpp DESTINATION ${build_include_dir}/io/network)
|
||||||
|
FILE(COPY ${include_dir}/io/network/network_error.hpp DESTINATION ${build_include_dir}/io/network)
|
||||||
|
FILE(COPY ${include_dir}/io/network/socket.hpp DESTINATION ${build_include_dir}/io/network)
|
||||||
|
|
||||||
|
FILE(COPY ${include_dir}/logging/default.hpp DESTINATION ${build_include_dir}/logging)
|
||||||
|
FILE(COPY ${include_dir}/logging/log.hpp DESTINATION ${build_include_dir}/logging)
|
||||||
|
FILE(COPY ${include_dir}/logging/logger.hpp DESTINATION ${build_include_dir}/logging)
|
||||||
|
FILE(COPY ${include_dir}/logging/levels.hpp DESTINATION ${build_include_dir}/logging)
|
||||||
|
FILE(COPY ${include_dir}/logging/loggable.hpp DESTINATION ${build_include_dir}/logging)
|
||||||
|
|
||||||
|
FILE(COPY ${include_dir}/snapshot/snapshot_engine.hpp DESTINATION ${build_include_dir}/snapshot)
|
||||||
|
# -----------------------------------------------------------------------------
|
@ -1,8 +1,27 @@
|
|||||||
|
###########################
|
||||||
|
# MEMGRAPH DEFAULT CONFIG #
|
||||||
|
###########################
|
||||||
|
|
||||||
|
# NOTE: all paths are relative to the run folder
|
||||||
|
# (where the executable is runned)
|
||||||
|
|
||||||
|
# path to the codes which will be compiled
|
||||||
compile_cpu_path: "./compiled/cpu/"
|
compile_cpu_path: "./compiled/cpu/"
|
||||||
template_cpu_cpp_path: "./template/template_code_cpu.cpp"
|
|
||||||
barrier_template_cpu_cpp_path: "./template/barrier_template_code_cpu.cpp"
|
# path to the template (cpp) for codes generation
|
||||||
|
template_cpu_cpp_path: "./template/template_code_cpu_cpp"
|
||||||
|
|
||||||
|
# path to the template (hpp) for codes generation
|
||||||
template_cpu_hpp_path: "./template/template_code_cpu.hpp"
|
template_cpu_hpp_path: "./template/template_code_cpu.hpp"
|
||||||
|
|
||||||
|
# path to the folder with snapshots
|
||||||
snapshots_path: "snapshots"
|
snapshots_path: "snapshots"
|
||||||
|
|
||||||
|
# leaning cycle interval
|
||||||
cleaning_cycle_sec: "300"
|
cleaning_cycle_sec: "300"
|
||||||
|
|
||||||
|
# snapshot cycle interval
|
||||||
snapshot_cycle_sec: "60"
|
snapshot_cycle_sec: "60"
|
||||||
|
|
||||||
|
# max number of snapshots which will be kept on the disk at some point
|
||||||
max_retained_snapshots: "3"
|
max_retained_snapshots: "3"
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
FROM ubuntu:16.04
|
|
||||||
|
|
||||||
# apt-get setup
|
|
||||||
RUN apt-get update \
|
|
||||||
&& apt-get install -y cmake git python clang wget \
|
|
||||||
&& apt-get install -y check libpcre3 libpcre3-dev libjemalloc-dev \
|
|
||||||
libjemalloc1 build-essential libtool automake \
|
|
||||||
autoconf pkg-config
|
|
||||||
# && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
||||||
|
|
||||||
# prepare source
|
|
||||||
RUN mkdir -p /memgraph/build
|
|
||||||
RUN mkdir -p /memgraph/libs
|
|
||||||
COPY libs/setup.sh /memgraph/libs/setup.sh
|
|
||||||
COPY src /memgraph/src
|
|
||||||
COPY tests /memgraph/tests
|
|
||||||
COPY CMakeLists.txt /memgraph/CMakeLists.txt
|
|
||||||
|
|
||||||
# setup libs
|
|
||||||
WORKDIR /memgraph/libs
|
|
||||||
RUN ./setup.sh
|
|
||||||
|
|
||||||
# build
|
|
||||||
WORKDIR /memgraph/build
|
|
||||||
RUN cmake -DCMAKE_C_COMPILER=clang \
|
|
||||||
-DCMAKE_CXX_COMPILER=clang++ \
|
|
||||||
-DRUNTIME_ASSERT=OFF \
|
|
||||||
-DTHROW_EXCEPTION_ON_ERROR=OFF \
|
|
||||||
-DNDEBUG=OFF ..
|
|
||||||
RUN make
|
|
||||||
|
|
||||||
# run
|
|
||||||
CMD /memgraph/build/memgraph 7474
|
|
1
example/.gitignore
vendored
Normal file
1
example/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.out
|
0
src/examples/timestamp.cpp → example/timestamp.cpp
Executable file → Normal file
0
src/examples/timestamp.cpp → example/timestamp.cpp
Executable file → Normal file
@ -5,6 +5,7 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -47,6 +48,7 @@ int main(void)
|
|||||||
|
|
||||||
auto max = std::accumulate(buckets.begin(), buckets.end(), 0u,
|
auto max = std::accumulate(buckets.begin(), buckets.end(), 0u,
|
||||||
[](auto& acc, auto& x) { return std::max(acc, x.load()); });
|
[](auto& acc, auto& x) { return std::max(acc, x.load()); });
|
||||||
|
assert(max != 0u);
|
||||||
|
|
||||||
std::cout << std::fixed;
|
std::cout << std::fixed;
|
||||||
|
|
@ -1,588 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#ifdef BARRIER
|
|
||||||
|
|
||||||
#include "barrier/common.hpp"
|
|
||||||
|
|
||||||
// This namespace is holding header parts of barrier classes. Barrier class
|
|
||||||
// object is in fact object from other class inside memgraph. Main purpose of
|
|
||||||
// barrier classes is to hide real classes from outside viewers. This header
|
|
||||||
// should be only to be included from memgraph into generated/compiled query.
|
|
||||||
// And this header must ensure that it defines all classes and methods required
|
|
||||||
// for querys.
|
|
||||||
namespace barrier
|
|
||||||
{
|
|
||||||
// Every class from database which must be visible to outside the barrier should
|
|
||||||
// have there barrier class defined here.
|
|
||||||
|
|
||||||
// ************ Here should be forward declarations of Sized barrier classes
|
|
||||||
// ACCESSORS
|
|
||||||
class DbAccessor;
|
|
||||||
class VertexAccessor;
|
|
||||||
class EdgeAccessor;
|
|
||||||
|
|
||||||
// GENERIC ITERATORS
|
|
||||||
class VertexIterator;
|
|
||||||
class EdgeIterator;
|
|
||||||
|
|
||||||
// TYPED ITERATORS
|
|
||||||
class VertexAccessIterator;
|
|
||||||
class EdgeAccessIterator;
|
|
||||||
class OutEdgesIterator;
|
|
||||||
class InEdgesIterator;
|
|
||||||
|
|
||||||
// PROPERTY
|
|
||||||
class VertexPropertyKey;
|
|
||||||
class EdgePropertyKey;
|
|
||||||
template <class T>
|
|
||||||
class VertexPropertyType;
|
|
||||||
template <class T>
|
|
||||||
class EdgePropertyType;
|
|
||||||
|
|
||||||
// BOLT
|
|
||||||
template <class Stream>
|
|
||||||
class RecordStream;
|
|
||||||
|
|
||||||
// ************ Here should be forward declarations of Unsized barrier classes
|
|
||||||
// COMMON
|
|
||||||
class Db;
|
|
||||||
class Label;
|
|
||||||
class EdgeType;
|
|
||||||
|
|
||||||
// GENERIC INDEXES
|
|
||||||
template <class K>
|
|
||||||
class VertexIndex;
|
|
||||||
template <class K>
|
|
||||||
class EdgeIndex;
|
|
||||||
|
|
||||||
// PROPERTY
|
|
||||||
class VertexPropertyFamily;
|
|
||||||
class EdgePropertyFamily;
|
|
||||||
|
|
||||||
// ************* Here should be defined usings
|
|
||||||
using label_ref_t = ReferenceWrapper<const Label>;
|
|
||||||
using VertexStoredProperty = PropertyHolder<VertexPropertyKey>;
|
|
||||||
using EdgeStoredProperty = PropertyHolder<EdgePropertyKey>;
|
|
||||||
|
|
||||||
// ************ Here should be definitions of Sized barrier classes
|
|
||||||
// Original class should have Sized barrier class if it can't be Unsized.
|
|
||||||
// Sized barrier classes should:
|
|
||||||
// --Have same name as original class.
|
|
||||||
// --Inherit Sized class from common.hpp as public. Blueprint:
|
|
||||||
// class class_name: public Sized<size_of_t,aligment_of_t>
|
|
||||||
// --Sized template arguments must be hardcoded numbers equal to sizeof(T) and
|
|
||||||
// alignof(T) where T is original class.
|
|
||||||
// --It should have undefined public constructor which is specialized in .cpp
|
|
||||||
// Blueprint:
|
|
||||||
// public:
|
|
||||||
// template<class T> class_name(T &&d);
|
|
||||||
// --It should delete or specify following methods depending on the behavior of
|
|
||||||
// the original class:
|
|
||||||
// public:
|
|
||||||
// class_name(const class_name &other);
|
|
||||||
// class_name(class_name &&other);
|
|
||||||
// ~class_name();
|
|
||||||
// class_name &operator=(const class_name &other);
|
|
||||||
// class_name &operator=(class_name &&other);
|
|
||||||
// --It should specify public methods which can be called on the original class.
|
|
||||||
//
|
|
||||||
// Blueprint:
|
|
||||||
// class class_name : public Sized<,>
|
|
||||||
// {
|
|
||||||
// public:
|
|
||||||
// template <class T>
|
|
||||||
// class_name(T &&d);
|
|
||||||
//
|
|
||||||
// class_name(const class_name &other);
|
|
||||||
// class_name(class_name &&other);
|
|
||||||
// ~class_name();
|
|
||||||
//
|
|
||||||
// class_name &operator=(const class_name &other);
|
|
||||||
// class_name &operator=(class_name &&other);
|
|
||||||
//
|
|
||||||
// };
|
|
||||||
|
|
||||||
// TODO: Extract methods od RecordAccessor for VertexAccessor and EdgeAccessor
|
|
||||||
// into joined class.
|
|
||||||
class VertexAccessor : private Sized<24, 8>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
template <class T>
|
|
||||||
VertexAccessor(T &&d);
|
|
||||||
|
|
||||||
VertexAccessor(VertexAccessor &other);
|
|
||||||
VertexAccessor(const VertexAccessor &other);
|
|
||||||
VertexAccessor(VertexAccessor &&other);
|
|
||||||
VertexAccessor(VertexAccessor const &&other);
|
|
||||||
~VertexAccessor();
|
|
||||||
|
|
||||||
VertexAccessor &operator=(const VertexAccessor &other);
|
|
||||||
VertexAccessor &operator=(VertexAccessor &&other);
|
|
||||||
|
|
||||||
bool isolated() const;
|
|
||||||
|
|
||||||
size_t out_degree() const;
|
|
||||||
|
|
||||||
size_t in_degree() const;
|
|
||||||
|
|
||||||
size_t degree() const;
|
|
||||||
|
|
||||||
bool add_label(const Label &label);
|
|
||||||
|
|
||||||
bool remove_label(const Label &label);
|
|
||||||
|
|
||||||
bool has_label(const Label &label) const;
|
|
||||||
|
|
||||||
const std::vector<label_ref_t> &labels() const;
|
|
||||||
|
|
||||||
OutEdgesIterator out() const;
|
|
||||||
|
|
||||||
InEdgesIterator in() const;
|
|
||||||
|
|
||||||
bool in_contains(VertexAccessor const &other) const;
|
|
||||||
|
|
||||||
bool empty() const;
|
|
||||||
|
|
||||||
bool fill() const;
|
|
||||||
|
|
||||||
const Id &id() const;
|
|
||||||
|
|
||||||
VertexAccessor update() const;
|
|
||||||
|
|
||||||
void remove() const;
|
|
||||||
|
|
||||||
// template <class TG>
|
|
||||||
// bool contains(property_key<TG> &key) const;
|
|
||||||
|
|
||||||
const VertexStoredProperty &at(VertexPropertyFamily &key) const;
|
|
||||||
|
|
||||||
const VertexStoredProperty &at(VertexPropertyKey &key) const;
|
|
||||||
|
|
||||||
template <class V>
|
|
||||||
OptionPtr<const V> at(VertexPropertyType<V> &key) const;
|
|
||||||
|
|
||||||
void set(VertexPropertyKey &key, Property &&value);
|
|
||||||
|
|
||||||
void clear(VertexPropertyKey &key);
|
|
||||||
|
|
||||||
void clear(VertexPropertyFamily &key);
|
|
||||||
|
|
||||||
template <class Handler>
|
|
||||||
void accept(Handler &handler) const;
|
|
||||||
|
|
||||||
explicit operator bool() const;
|
|
||||||
|
|
||||||
friend bool operator==(const VertexAccessor &a, const VertexAccessor &b);
|
|
||||||
|
|
||||||
friend bool operator!=(const VertexAccessor &a, const VertexAccessor &b);
|
|
||||||
};
|
|
||||||
|
|
||||||
class EdgeAccessor : private Sized<24, 8>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
template <class T>
|
|
||||||
EdgeAccessor(T &&d);
|
|
||||||
|
|
||||||
EdgeAccessor(EdgeAccessor &other);
|
|
||||||
EdgeAccessor(const EdgeAccessor &other);
|
|
||||||
EdgeAccessor(EdgeAccessor &&other);
|
|
||||||
EdgeAccessor(EdgeAccessor const &&other);
|
|
||||||
~EdgeAccessor();
|
|
||||||
|
|
||||||
EdgeAccessor &operator=(const EdgeAccessor &other);
|
|
||||||
EdgeAccessor &operator=(EdgeAccessor &&other);
|
|
||||||
|
|
||||||
void edge_type(const EdgeType &edge_type);
|
|
||||||
|
|
||||||
const EdgeType &edge_type() const;
|
|
||||||
|
|
||||||
const VertexAccessor from() const;
|
|
||||||
|
|
||||||
const VertexAccessor to() const;
|
|
||||||
|
|
||||||
bool empty() const;
|
|
||||||
|
|
||||||
bool fill() const;
|
|
||||||
|
|
||||||
const Id &id() const;
|
|
||||||
|
|
||||||
EdgeAccessor update() const;
|
|
||||||
|
|
||||||
void remove() const;
|
|
||||||
|
|
||||||
const EdgeStoredProperty &at(EdgePropertyFamily &key) const;
|
|
||||||
|
|
||||||
const EdgeStoredProperty &at(EdgePropertyKey &key) const;
|
|
||||||
|
|
||||||
template <class V>
|
|
||||||
OptionPtr<const V> at(EdgePropertyType<V> &key) const;
|
|
||||||
|
|
||||||
void set(EdgePropertyKey &key, Property &&value);
|
|
||||||
|
|
||||||
void clear(EdgePropertyKey &key);
|
|
||||||
|
|
||||||
void clear(EdgePropertyFamily &key);
|
|
||||||
|
|
||||||
template <class Handler>
|
|
||||||
void accept(Handler &handler) const;
|
|
||||||
|
|
||||||
explicit operator bool() const;
|
|
||||||
|
|
||||||
friend bool operator==(const EdgeAccessor &a, const EdgeAccessor &b);
|
|
||||||
|
|
||||||
friend bool operator!=(const EdgeAccessor &a, const EdgeAccessor &b);
|
|
||||||
};
|
|
||||||
|
|
||||||
class DbAccessor : protected Sized<40, 8>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DbAccessor(Db &d);
|
|
||||||
|
|
||||||
DbAccessor(const DbAccessor &other) = delete;
|
|
||||||
DbAccessor(DbAccessor &&other) = delete;
|
|
||||||
~DbAccessor();
|
|
||||||
|
|
||||||
DbAccessor &operator=(const DbAccessor &other) = delete;
|
|
||||||
DbAccessor &operator=(DbAccessor &&other) = delete;
|
|
||||||
|
|
||||||
VertexAccessIterator vertex_access();
|
|
||||||
|
|
||||||
Option<const VertexAccessor> vertex_find(const Id &id);
|
|
||||||
|
|
||||||
VertexAccessor vertex_insert();
|
|
||||||
|
|
||||||
EdgeAccessIterator edge_access();
|
|
||||||
|
|
||||||
Option<const EdgeAccessor> edge_find(const Id &id);
|
|
||||||
|
|
||||||
EdgeAccessor edge_insert(VertexAccessor const &from,
|
|
||||||
VertexAccessor const &to);
|
|
||||||
|
|
||||||
const Label &label_find_or_create(const char *name);
|
|
||||||
|
|
||||||
bool label_contains(const char *name);
|
|
||||||
|
|
||||||
const EdgeType &type_find_or_create(const char *name);
|
|
||||||
|
|
||||||
bool type_contains(const char *name);
|
|
||||||
|
|
||||||
VertexPropertyFamily &vertex_property_family_get(const std::string &name);
|
|
||||||
|
|
||||||
EdgePropertyFamily &edge_property_family_get(const std::string &name);
|
|
||||||
|
|
||||||
VertexPropertyKey vertex_property_key(const std::string &name, Type type);
|
|
||||||
|
|
||||||
EdgePropertyKey edge_property_key(const std::string &name, Type type);
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
VertexPropertyType<T> vertex_property_key(const std::string &name);
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
EdgePropertyType<T> edge_property_key(const std::string &name);
|
|
||||||
|
|
||||||
bool commit();
|
|
||||||
void abort();
|
|
||||||
};
|
|
||||||
|
|
||||||
class VertexIterator
|
|
||||||
: public Sized<8, 8>,
|
|
||||||
public iter::Composable<const VertexAccessor, VertexIterator>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
template <class T>
|
|
||||||
VertexIterator(T &&d);
|
|
||||||
|
|
||||||
VertexIterator(const VertexIterator &other) = delete;
|
|
||||||
VertexIterator(VertexIterator &&other);
|
|
||||||
~VertexIterator();
|
|
||||||
VertexIterator &operator=(const VertexIterator &other) = delete;
|
|
||||||
VertexIterator &operator=(VertexIterator &&other) = delete;
|
|
||||||
|
|
||||||
Option<const VertexAccessor> next();
|
|
||||||
|
|
||||||
Count count();
|
|
||||||
};
|
|
||||||
|
|
||||||
// NOTE: This large size is because of SkipList accessor which is embeded into
|
|
||||||
// iterator. The accessor has 64 fields of pointers which is in total 512 B.
|
|
||||||
class VertexAccessIterator
|
|
||||||
: public Sized<560, 8>,
|
|
||||||
public iter::Composable<const VertexAccessor, VertexAccessIterator>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
template <class T>
|
|
||||||
VertexAccessIterator(T &&d);
|
|
||||||
|
|
||||||
VertexAccessIterator(const VertexAccessIterator &other) = delete;
|
|
||||||
VertexAccessIterator(VertexAccessIterator &&other);
|
|
||||||
~VertexAccessIterator();
|
|
||||||
VertexAccessIterator &operator=(const VertexAccessIterator &other) = delete;
|
|
||||||
VertexAccessIterator &operator=(VertexAccessIterator &&other) = delete;
|
|
||||||
|
|
||||||
Option<const VertexAccessor> next();
|
|
||||||
|
|
||||||
Count count();
|
|
||||||
};
|
|
||||||
|
|
||||||
// NOTE: This large size is because of SkipList accessor which is embeded into
|
|
||||||
// iterator. The accessor has 64 fields of pointers which is in total 512 B.
|
|
||||||
class EdgeAccessIterator
|
|
||||||
: public Sized<560, 8>,
|
|
||||||
public iter::Composable<const EdgeAccessor, EdgeAccessIterator>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
template <class T>
|
|
||||||
EdgeAccessIterator(T &&d);
|
|
||||||
|
|
||||||
EdgeAccessIterator(const EdgeAccessIterator &other) = delete;
|
|
||||||
EdgeAccessIterator(EdgeAccessIterator &&other);
|
|
||||||
~EdgeAccessIterator();
|
|
||||||
EdgeAccessIterator &operator=(const EdgeAccessIterator &other) = delete;
|
|
||||||
EdgeAccessIterator &operator=(EdgeAccessIterator &&other) = delete;
|
|
||||||
|
|
||||||
Option<const EdgeAccessor> next();
|
|
||||||
|
|
||||||
Count count();
|
|
||||||
};
|
|
||||||
|
|
||||||
class OutEdgesIterator
|
|
||||||
: public Sized<48, 8>,
|
|
||||||
public iter::Composable<const EdgeAccessor, OutEdgesIterator>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
template <class T>
|
|
||||||
OutEdgesIterator(T &&d);
|
|
||||||
|
|
||||||
OutEdgesIterator(const OutEdgesIterator &other) = delete;
|
|
||||||
OutEdgesIterator(OutEdgesIterator &&other);
|
|
||||||
~OutEdgesIterator();
|
|
||||||
OutEdgesIterator &operator=(const OutEdgesIterator &other) = delete;
|
|
||||||
OutEdgesIterator &operator=(OutEdgesIterator &&other) = delete;
|
|
||||||
|
|
||||||
Option<const EdgeAccessor> next();
|
|
||||||
|
|
||||||
Count count();
|
|
||||||
};
|
|
||||||
|
|
||||||
class InEdgesIterator
|
|
||||||
: public Sized<64, 8>,
|
|
||||||
public iter::Composable<const EdgeAccessor, InEdgesIterator>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
template <class T>
|
|
||||||
InEdgesIterator(T &&d);
|
|
||||||
|
|
||||||
InEdgesIterator(const InEdgesIterator &other) = delete;
|
|
||||||
InEdgesIterator(InEdgesIterator &&other);
|
|
||||||
~InEdgesIterator();
|
|
||||||
InEdgesIterator &operator=(const InEdgesIterator &other) = delete;
|
|
||||||
InEdgesIterator &operator=(InEdgesIterator &&other) = delete;
|
|
||||||
|
|
||||||
Option<const EdgeAccessor> next();
|
|
||||||
|
|
||||||
Count count();
|
|
||||||
};
|
|
||||||
|
|
||||||
class EdgeIterator : public Sized<8, 8>,
|
|
||||||
public iter::Composable<const EdgeAccessor, EdgeIterator>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
template <class T>
|
|
||||||
EdgeIterator(T &&d);
|
|
||||||
|
|
||||||
EdgeIterator(const EdgeIterator &other) = delete;
|
|
||||||
EdgeIterator(EdgeIterator &&other);
|
|
||||||
~EdgeIterator();
|
|
||||||
EdgeIterator &operator=(const EdgeIterator &other) = delete;
|
|
||||||
EdgeIterator &operator=(EdgeIterator &&other) = delete;
|
|
||||||
|
|
||||||
Option<const EdgeAccessor> next();
|
|
||||||
|
|
||||||
Count count();
|
|
||||||
|
|
||||||
EdgeIterator &operator->() { return *this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
class VertexPropertyKey : private Sized<8, 8>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
template <class T>
|
|
||||||
VertexPropertyKey(T &&d);
|
|
||||||
|
|
||||||
VertexPropertyKey(const VertexPropertyKey &other) = default;
|
|
||||||
VertexPropertyKey(VertexPropertyKey &&other) = default;
|
|
||||||
~VertexPropertyKey();
|
|
||||||
|
|
||||||
VertexPropertyKey &operator=(const VertexPropertyKey &other) = default;
|
|
||||||
VertexPropertyKey &operator=(VertexPropertyKey &&other) = default;
|
|
||||||
|
|
||||||
Type get_type() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
class EdgePropertyKey : private Sized<8, 8>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
template <class T>
|
|
||||||
EdgePropertyKey(T &&d);
|
|
||||||
|
|
||||||
EdgePropertyKey(const EdgePropertyKey &other) = default;
|
|
||||||
EdgePropertyKey(EdgePropertyKey &&other) = default;
|
|
||||||
~EdgePropertyKey();
|
|
||||||
|
|
||||||
EdgePropertyKey &operator=(const EdgePropertyKey &other) = default;
|
|
||||||
EdgePropertyKey &operator=(EdgePropertyKey &&other) = default;
|
|
||||||
|
|
||||||
Type get_type() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class K>
|
|
||||||
class VertexPropertyType : private Sized<8, 8>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
template <class T>
|
|
||||||
VertexPropertyType(T &&d);
|
|
||||||
|
|
||||||
VertexPropertyType(const VertexPropertyType &other) = default;
|
|
||||||
VertexPropertyType(VertexPropertyType &&other) = default;
|
|
||||||
~VertexPropertyType(){};
|
|
||||||
|
|
||||||
VertexPropertyType &operator=(const VertexPropertyType &other) = default;
|
|
||||||
VertexPropertyType &operator=(VertexPropertyType &&other) = default;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class K>
|
|
||||||
class EdgePropertyType : private Sized<8, 8>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
template <class T>
|
|
||||||
EdgePropertyType(T &&d);
|
|
||||||
|
|
||||||
EdgePropertyType(const EdgePropertyType &other) = default;
|
|
||||||
EdgePropertyType(EdgePropertyType &&other) = default;
|
|
||||||
~EdgePropertyType(){};
|
|
||||||
|
|
||||||
EdgePropertyType &operator=(const EdgePropertyType &other) = default;
|
|
||||||
EdgePropertyType &operator=(EdgePropertyType &&other) = default;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
class RecordStream : private Sized<8, 8>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
template <class T>
|
|
||||||
RecordStream(T &&d);
|
|
||||||
|
|
||||||
RecordStream(const RecordStream &other) = default;
|
|
||||||
RecordStream(RecordStream &&other) = default;
|
|
||||||
~RecordStream();
|
|
||||||
|
|
||||||
RecordStream &operator=(const RecordStream &other) = default;
|
|
||||||
RecordStream &operator=(RecordStream &&other) = default;
|
|
||||||
|
|
||||||
void write(const VertexAccessor &vertex);
|
|
||||||
void write(const EdgeAccessor &edge);
|
|
||||||
void write(const VertexStoredProperty &prop);
|
|
||||||
void write(const EdgeStoredProperty &prop);
|
|
||||||
void write(const Null &v);
|
|
||||||
void write(const Bool &prop);
|
|
||||||
void write(const Float &prop);
|
|
||||||
void write(const Double &prop);
|
|
||||||
void write(const Int32 &prop);
|
|
||||||
void write(const Int64 &prop);
|
|
||||||
void write(const String &prop);
|
|
||||||
void write(const ArrayBool &);
|
|
||||||
void write(const ArrayInt32 &);
|
|
||||||
void write(const ArrayInt64 &);
|
|
||||||
void write(const ArrayFloat &);
|
|
||||||
void write(const ArrayDouble &);
|
|
||||||
void write(const ArrayString &);
|
|
||||||
|
|
||||||
void write_empty_fields();
|
|
||||||
void write_success();
|
|
||||||
void write_success_empty();
|
|
||||||
void write_ignored();
|
|
||||||
void write_fields(const std::vector<std::string> &fields);
|
|
||||||
void write_field(const std::string &field);
|
|
||||||
void write_list_header(size_t size);
|
|
||||||
void write_record();
|
|
||||||
void write_meta(const std::string &type);
|
|
||||||
void write_failure(const std::map<std::string, std::string> &data);
|
|
||||||
void send();
|
|
||||||
void chunk();
|
|
||||||
};
|
|
||||||
|
|
||||||
// ************ Here should be definitions of Unsized barrier classes
|
|
||||||
// Original class can be Unsized barrier class if they are only used outside the
|
|
||||||
// barrier through reference/pointer.
|
|
||||||
// Usized barrier classes should:
|
|
||||||
// --Have same name as original class or somethin more specific if it is
|
|
||||||
// partialy specialized.
|
|
||||||
// --Inherit Unsized class from common.hpp as protected. Blueprint:
|
|
||||||
// class class_name: protected Unsized
|
|
||||||
// --It should specify public methods which can be called on the original class.
|
|
||||||
//
|
|
||||||
// Blueprint:
|
|
||||||
// class class_name : protected Unsized
|
|
||||||
// {
|
|
||||||
// public:
|
|
||||||
//
|
|
||||||
// };
|
|
||||||
|
|
||||||
class VertexPropertyFamily : protected Unsized
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
OptionPtr<VertexIndex<std::nullptr_t>> index();
|
|
||||||
};
|
|
||||||
|
|
||||||
class EdgePropertyFamily : protected Unsized
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
OptionPtr<EdgeIndex<std::nullptr_t>> index();
|
|
||||||
};
|
|
||||||
|
|
||||||
class Label : protected Unsized
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
VertexIndex<std::nullptr_t> &index() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
class EdgeType : protected Unsized
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
friend bool operator<(const EdgeType &lhs, const EdgeType &rhs);
|
|
||||||
|
|
||||||
friend bool operator==(const EdgeType &lhs, const EdgeType &rhs);
|
|
||||||
|
|
||||||
EdgeIndex<std::nullptr_t> &index() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class K>
|
|
||||||
class VertexIndex : protected Unsized
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// TODO: This iterator sometimes has known type. It can be added to this
|
|
||||||
// border to avoid dynamic dispatch
|
|
||||||
VertexIterator for_range(DbAccessor &, Border<K> from = Border<K>(),
|
|
||||||
Border<K> to = Border<K>());
|
|
||||||
|
|
||||||
IndexType type();
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class K>
|
|
||||||
class EdgeIndex : protected Unsized
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// TODO: This iterator has known type. It can be added to this border to
|
|
||||||
// avoid dynamic dispatch
|
|
||||||
EdgeIterator for_range(DbAccessor &, Border<K> from = Border<K>(),
|
|
||||||
Border<K> to = Border<K>());
|
|
||||||
|
|
||||||
IndexType type();
|
|
||||||
};
|
|
||||||
|
|
||||||
class Db : protected Unsized
|
|
||||||
{
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,142 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#ifdef BARRIER
|
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
#include <map>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <utility>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
// This shoul be the only place to include code from memgraph other than
|
|
||||||
// barrier.cpp
|
|
||||||
#include "mvcc/id.hpp"
|
|
||||||
#include "storage/indexes/index_definition.hpp"
|
|
||||||
#include "storage/model/properties/all.hpp"
|
|
||||||
#include "storage/model/properties/property.hpp"
|
|
||||||
#include "utils/border.hpp"
|
|
||||||
#include "utils/iterator/iterator.hpp"
|
|
||||||
#include "utils/option_ptr.hpp"
|
|
||||||
#include "utils/reference_wrapper.hpp"
|
|
||||||
|
|
||||||
// Contains common classes and functions for barrier.hpp and barrier.cpp.
|
|
||||||
namespace barrier
|
|
||||||
{
|
|
||||||
|
|
||||||
// This define accepts other define which accepts property type to instantiate
|
|
||||||
// template. Recieved define will be called for all property types.
|
|
||||||
#define INSTANTIATE_FOR_PROPERTY(x) \
|
|
||||||
x(Int32) x(Int64) x(Float) x(Double) x(Bool) x(String) x(ArrayInt32) \
|
|
||||||
x(ArrayInt64) x(ArrayFloat) x(ArrayDouble) x(ArrayBool) x(ArrayString)
|
|
||||||
|
|
||||||
// **************************** HELPER FUNCTIONS **************************** //
|
|
||||||
// CASTS FROM& -> TO&
|
|
||||||
template <class TO, class FROM>
|
|
||||||
TO &ref_as(FROM &ref)
|
|
||||||
{
|
|
||||||
return (*reinterpret_cast<TO *>(&ref));
|
|
||||||
}
|
|
||||||
|
|
||||||
// CASTS FROM const& -> TO const&
|
|
||||||
template <class TO, class FROM>
|
|
||||||
TO const &ref_as(FROM const &ref)
|
|
||||||
{
|
|
||||||
return (*reinterpret_cast<TO const *>(&ref));
|
|
||||||
}
|
|
||||||
|
|
||||||
// CASTS FROM* -> TO*
|
|
||||||
template <class TO, class FROM>
|
|
||||||
TO *ptr_as(FROM *ref)
|
|
||||||
{
|
|
||||||
return (reinterpret_cast<TO *>(ref));
|
|
||||||
}
|
|
||||||
|
|
||||||
// CASTS FROM const* -> TO const*
|
|
||||||
template <class TO, class FROM>
|
|
||||||
TO const *ptr_as(FROM const *ref)
|
|
||||||
{
|
|
||||||
return (reinterpret_cast<TO const *>(ref));
|
|
||||||
}
|
|
||||||
|
|
||||||
// CASTS FROM&& -> TO&&
|
|
||||||
template <class TO, class FROM>
|
|
||||||
TO &&value_as(FROM &&ref)
|
|
||||||
{
|
|
||||||
static_assert(sizeof(TO) == sizeof(FROM), "Border class size mismatch");
|
|
||||||
static_assert(alignof(TO) == alignof(FROM),
|
|
||||||
"Border class aligment mismatch");
|
|
||||||
return (reinterpret_cast<TO &&>(std::move(ref)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// CASTS FROM const&& -> TO const&&
|
|
||||||
template <class TO, class FROM>
|
|
||||||
const TO &&value_as(const FROM &&ref)
|
|
||||||
{
|
|
||||||
static_assert(sizeof(TO) == sizeof(FROM), "Border class size mismatch");
|
|
||||||
static_assert(alignof(TO) == alignof(FROM),
|
|
||||||
"Border class aligment mismatch");
|
|
||||||
return (reinterpret_cast<TO const &&>(std::move(ref)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Barrier classes which will be used only through reference/pointer should
|
|
||||||
// inherit this class. Outside of barrier derived classes will be used only
|
|
||||||
// through reference/pointer.
|
|
||||||
class Unsized
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// Deleting following constructors/destroyers and opertators will assure
|
|
||||||
// that this class/derived classes can't be created,copyed,deleted or moved.
|
|
||||||
// This way the other side can't "accidentaly" create/copy/destroy or move
|
|
||||||
// objects which inherit this class because that would be erroneous.
|
|
||||||
Unsized() = delete;
|
|
||||||
Unsized(const Unsized &other) = delete;
|
|
||||||
Unsized(Unsized &&other) = delete;
|
|
||||||
~Unsized() = delete;
|
|
||||||
Unsized &operator=(const Unsized &other) = delete;
|
|
||||||
Unsized &operator=(Unsized &&other) = delete;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Barrier classes which will be used as value should inherit this class.
|
|
||||||
// Template accepts size_B in B of object of original class from memgraph.
|
|
||||||
// Template accepts alignment_B in B of object of original class from memgraph.
|
|
||||||
template <std::size_t size_B, std::size_t alignment_B>
|
|
||||||
class Sized
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
// This will ensure that this/derived class can't be instantiated.
|
|
||||||
// Something outside the barrier can't "accidentaly" create this/derived
|
|
||||||
// type because that would be erroneous.
|
|
||||||
Sized() = delete;
|
|
||||||
|
|
||||||
// This constructor serves as a check for correctness of size_B and
|
|
||||||
// alignment_B template parametars. Derived class MUST call this constructor
|
|
||||||
// with T which it holds where T is original class from memgraph.
|
|
||||||
template <class T>
|
|
||||||
Sized(T &&d)
|
|
||||||
{
|
|
||||||
new (ptr_as<T>(&data)) T(std::move(d));
|
|
||||||
static_assert(size_B == sizeof(T), "Border class size mismatch");
|
|
||||||
static_assert(alignment_B == alignof(T),
|
|
||||||
"Border class aligment mismatch");
|
|
||||||
}
|
|
||||||
|
|
||||||
// This constructor serves as a check for correctness of size_B and
|
|
||||||
// alignment_B template parametars. Derived class MUST call this constructor
|
|
||||||
// with T which it holds where T is original class from memgraph.
|
|
||||||
template <class T>
|
|
||||||
Sized(const T &&d)
|
|
||||||
{
|
|
||||||
new (ptr_as<T>(&data)) T(std::move(d));
|
|
||||||
static_assert(size_B == sizeof(T), "Border class size mismatch");
|
|
||||||
static_assert(alignment_B == alignof(T),
|
|
||||||
"Border class aligment mismatch");
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
// Here is the aligned storage which imitates size and aligment of object of
|
|
||||||
// original class from memgraph.
|
|
||||||
typename std::aligned_storage<size_B, alignment_B>::type data;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,269 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#ifdef BARRIER
|
|
||||||
|
|
||||||
#include "barrier/barrier.hpp"
|
|
||||||
|
|
||||||
// This is the place for imports from memgraph .hpp
|
|
||||||
#include "communication/bolt/v1/serialization/bolt_serializer.hpp"
|
|
||||||
#include "communication/bolt/v1/serialization/record_stream.hpp"
|
|
||||||
#include "database/db.hpp"
|
|
||||||
#include "database/db_accessor.hpp"
|
|
||||||
#include "io/network/socket.hpp"
|
|
||||||
#include "storage/edge_type/edge_type.hpp"
|
|
||||||
#include "storage/edge_x_vertex.hpp"
|
|
||||||
#include "storage/label/label.hpp"
|
|
||||||
|
|
||||||
// This is the place for imports from memgraph .cpp
|
|
||||||
|
|
||||||
// **************************** HELPER DEFINES *******************************//
|
|
||||||
// Creates 8 functions for transformation of refereces between types x and y.
|
|
||||||
// Where x is a border type.
|
|
||||||
// DANGEROUS
|
|
||||||
#define TRANSFORM_REF(x, y) \
|
|
||||||
x &trans(y &l) { return ref_as<x>(l); } \
|
|
||||||
x const &trans(y const &l) { return ref_as<x const>(l); } \
|
|
||||||
y &trans(x &l) { return ref_as<y>(l); } \
|
|
||||||
y const &trans(x const &l) { return ref_as<y const>(l); } \
|
|
||||||
x *trans(y *l) { return ptr_as<x>(l); } \
|
|
||||||
x const *trans(y const *l) { return ptr_as<x const>(l); } \
|
|
||||||
y *trans(x *l) { return ptr_as<y>(l); } \
|
|
||||||
y const *trans(x const *l) { return ptr_as<y const>(l); }
|
|
||||||
|
|
||||||
// Creates 4 functions for transformation of refereces between types x and y.
|
|
||||||
// Where x is a sized border type.
|
|
||||||
// DANGEROUS
|
|
||||||
#define TRANSFORM_REF_SIZED(x, y) \
|
|
||||||
y &trans(x &l) { return ref_as<y>(l._data_ref()); } \
|
|
||||||
y const &trans(x const &l) \
|
|
||||||
{ \
|
|
||||||
return ref_as<y const>(l._data_ref_const()); \
|
|
||||||
} \
|
|
||||||
y *trans(x *l) { return ptr_as<y>(&(l->_data_ref())); } \
|
|
||||||
y const *trans(x const *l) \
|
|
||||||
{ \
|
|
||||||
return ptr_as<y const>(&(l->_data_ref_const())); \
|
|
||||||
}
|
|
||||||
|
|
||||||
// Creates 8 functions for transformation of refereces between types x and y.
|
|
||||||
// Where both x and y are templates over T. Where x is a border type.
|
|
||||||
// DANGEROUS
|
|
||||||
#define TRANSFORM_REF_TEMPLATED(x, y) \
|
|
||||||
x &trans(y &l) { return ref_as<x>(l); } \
|
|
||||||
template <class T> \
|
|
||||||
x const &trans(y const &l) \
|
|
||||||
{ \
|
|
||||||
return ref_as<const x>(l); \
|
|
||||||
} \
|
|
||||||
template <class T> \
|
|
||||||
y &trans(x &l) \
|
|
||||||
{ \
|
|
||||||
return ref_as<y>(l); \
|
|
||||||
} \
|
|
||||||
template <class T> \
|
|
||||||
y const &trans(x const &l) \
|
|
||||||
{ \
|
|
||||||
return ref_as<const y>(l); \
|
|
||||||
} \
|
|
||||||
template <class T> \
|
|
||||||
x *trans(y *l) \
|
|
||||||
{ \
|
|
||||||
return ptr_as<x>(l); \
|
|
||||||
} \
|
|
||||||
template <class T> \
|
|
||||||
const x *trans(const y *l) \
|
|
||||||
{ \
|
|
||||||
return ptr_as<const x>(l); \
|
|
||||||
} \
|
|
||||||
template <class T> \
|
|
||||||
y *trans(x *l) \
|
|
||||||
{ \
|
|
||||||
return ptr_as<y>(l); \
|
|
||||||
} \
|
|
||||||
template <class T> \
|
|
||||||
const y *trans(const x *l) \
|
|
||||||
{ \
|
|
||||||
return ptr_as<const y>(l); \
|
|
||||||
}
|
|
||||||
|
|
||||||
// For certain classes trans evaluates into ref which doesnt work for Sized
|
|
||||||
// constructor. This Move forces type y.
|
|
||||||
// DANGEROUS
|
|
||||||
#define MOVE_CONSTRUCTOR_FORCED(x, y) \
|
|
||||||
x::x(x &&other) : Sized(value_as<y>(std::move(other))) {}
|
|
||||||
|
|
||||||
// Creates constructor x(y) where x is border type and y shpuld be his original
|
|
||||||
// type.
|
|
||||||
// DANGEROUS
|
|
||||||
#define VALID_CONSTRUCTION(x, y) \
|
|
||||||
template <> \
|
|
||||||
barrier::x::x(y &&d) : Sized(std::move(d)) \
|
|
||||||
{ \
|
|
||||||
}
|
|
||||||
|
|
||||||
// Creates const constructor x(y) where x is border type and y shpuld be his
|
|
||||||
// original type.
|
|
||||||
// DANGEROUS
|
|
||||||
#define VALID_CONSTRUCTION_CONST(x, y) \
|
|
||||||
template <> \
|
|
||||||
barrier::x::x(y const &&d) : Sized(std::move(d)) \
|
|
||||||
{ \
|
|
||||||
}
|
|
||||||
|
|
||||||
// Creates value transformation function from original type y to border type x.
|
|
||||||
// DANGEROUS
|
|
||||||
#define TRANSFORM_VALUE_ONE_RAW(x, y) \
|
|
||||||
x trans(y &&d) { return x(std::move(d)); }
|
|
||||||
|
|
||||||
// Creates value transformation function and constructor from original type y to
|
|
||||||
// border type x.
|
|
||||||
// DANGEROUS
|
|
||||||
#define TRANSFORM_VALUE_ONE(x, y) \
|
|
||||||
VALID_CONSTRUCTION(x, y) \
|
|
||||||
x trans(y &&d) { return x(std::move(d)); }
|
|
||||||
|
|
||||||
// Creates value transformation functions and constructor between border type x
|
|
||||||
// and original type y. Only mutable values.
|
|
||||||
// DANGEROUS
|
|
||||||
#define TRANSFORM_VALUE_MUT(x, y) \
|
|
||||||
TRANSFORM_VALUE_ONE(x, y) \
|
|
||||||
y trans(x &&d) { return value_as<y>(std::move(d)); }
|
|
||||||
|
|
||||||
// Creates value transformation functions and constructors between border type x
|
|
||||||
// and original type y.
|
|
||||||
// DANGEROUS
|
|
||||||
#define TRANSFORM_VALUE(x, y) \
|
|
||||||
TRANSFORM_VALUE_MUT(x, y) \
|
|
||||||
VALID_CONSTRUCTION_CONST(x, y) \
|
|
||||||
const x trans(const y &&d) { return x(std::move(d)); } \
|
|
||||||
const y trans(const x &&d) { return value_as<const y>(std::move(d)); }
|
|
||||||
|
|
||||||
// Duplicates given x to call y with x and ::x
|
|
||||||
#define DUP(x, y) y(x, ::x)
|
|
||||||
|
|
||||||
// ********************** TYPES OF AUTO
|
|
||||||
using vertex_access_iterator_t =
|
|
||||||
decltype(((::DbAccessor *)(std::nullptr_t()))->vertex_access());
|
|
||||||
|
|
||||||
using edge_access_iterator_t =
|
|
||||||
decltype(((::DbAccessor *)(std::nullptr_t()))->edge_access());
|
|
||||||
|
|
||||||
using out_edge_iterator_t =
|
|
||||||
decltype(((::VertexAccessor *)(std::nullptr_t()))->out());
|
|
||||||
|
|
||||||
using in_edge_iterator_t =
|
|
||||||
decltype(((::VertexAccessor *)(std::nullptr_t()))->in());
|
|
||||||
|
|
||||||
// ******************** OVERLOADED trans FUNCTIONS.
|
|
||||||
// This enclosure is the only dangerous part of barrier except of Sized class in
|
|
||||||
// common.hpp
|
|
||||||
namespace barrier
|
|
||||||
{
|
|
||||||
// Blueprint for valid transformation of references:
|
|
||||||
// TRANSFORM_REF(, ::);
|
|
||||||
// template <class T> TRANSFORM_REF_TEMPLATED(<T>,::<T>);
|
|
||||||
// TODO: Strongest assurance that evertyhing is correct is for all of following
|
|
||||||
// transformation to use DUP for defining theres transformation. This would mean
|
|
||||||
// that names of classes exported in barrier and names from real class in
|
|
||||||
// database are equal.
|
|
||||||
|
|
||||||
// ***************** TRANSFORMS of reference and pointers
|
|
||||||
DUP(Label, TRANSFORM_REF);
|
|
||||||
DUP(EdgeType, TRANSFORM_REF);
|
|
||||||
DUP(VertexPropertyFamily, TRANSFORM_REF);
|
|
||||||
DUP(EdgePropertyFamily, TRANSFORM_REF);
|
|
||||||
DUP(VertexAccessor, TRANSFORM_REF);
|
|
||||||
DUP(EdgeAccessor, TRANSFORM_REF);
|
|
||||||
DUP(Db, TRANSFORM_REF);
|
|
||||||
DUP(DbAccessor, TRANSFORM_REF);
|
|
||||||
TRANSFORM_REF(std::vector<label_ref_t>, std::vector<::label_ref_t>);
|
|
||||||
TRANSFORM_REF(VertexPropertyKey,
|
|
||||||
::VertexPropertyFamily::PropertyType::PropertyFamilyKey);
|
|
||||||
TRANSFORM_REF(EdgePropertyKey,
|
|
||||||
::EdgePropertyFamily::PropertyType::PropertyFamilyKey);
|
|
||||||
TRANSFORM_REF(VertexStoredProperty, ::StoredProperty<TypeGroupVertex>);
|
|
||||||
TRANSFORM_REF(EdgeStoredProperty, ::StoredProperty<TypeGroupEdge>);
|
|
||||||
|
|
||||||
// ITERATORS
|
|
||||||
TRANSFORM_REF(VertexIterator, ::iter::Virtual<const ::VertexAccessor>);
|
|
||||||
TRANSFORM_REF(EdgeIterator, ::iter::Virtual<const ::EdgeAccessor>);
|
|
||||||
TRANSFORM_REF(VertexAccessIterator, vertex_access_iterator_t);
|
|
||||||
TRANSFORM_REF(EdgeAccessIterator, edge_access_iterator_t);
|
|
||||||
TRANSFORM_REF(OutEdgesIterator, out_edge_iterator_t);
|
|
||||||
TRANSFORM_REF(InEdgesIterator, in_edge_iterator_t);
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
TRANSFORM_REF_TEMPLATED(VertexIndex<T>, VertexIndexBase<T>);
|
|
||||||
template <class T>
|
|
||||||
TRANSFORM_REF_TEMPLATED(EdgeIndex<T>, EdgeIndexBase<T>);
|
|
||||||
template <class T>
|
|
||||||
TRANSFORM_REF_TEMPLATED(RecordStream<T>, ::bolt::RecordStream<T>);
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
TRANSFORM_REF_TEMPLATED(
|
|
||||||
VertexPropertyType<T>,
|
|
||||||
::VertexPropertyFamily::PropertyType::PropertyTypeKey<T>);
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
TRANSFORM_REF_TEMPLATED(EdgePropertyType<T>,
|
|
||||||
::EdgePropertyFamily::PropertyType::PropertyTypeKey<T>);
|
|
||||||
|
|
||||||
// ****************** TRANSFORMS of value
|
|
||||||
// Blueprint for valid transformation of value:
|
|
||||||
// TRANSFORM_VALUE(, ::);
|
|
||||||
DUP(VertexAccessor, TRANSFORM_VALUE);
|
|
||||||
DUP(EdgeAccessor, TRANSFORM_VALUE);
|
|
||||||
TRANSFORM_VALUE(EdgePropertyKey,
|
|
||||||
::EdgePropertyFamily::PropertyType::PropertyFamilyKey);
|
|
||||||
TRANSFORM_VALUE(VertexPropertyKey,
|
|
||||||
::VertexPropertyFamily::PropertyType::PropertyFamilyKey);
|
|
||||||
TRANSFORM_VALUE_ONE(VertexAccessIterator, vertex_access_iterator_t);
|
|
||||||
MOVE_CONSTRUCTOR_FORCED(VertexAccessIterator, vertex_access_iterator_t);
|
|
||||||
TRANSFORM_VALUE_ONE(EdgeAccessIterator, edge_access_iterator_t);
|
|
||||||
MOVE_CONSTRUCTOR_FORCED(EdgeAccessIterator, edge_access_iterator_t);
|
|
||||||
TRANSFORM_VALUE_ONE(OutEdgesIterator, out_edge_iterator_t);
|
|
||||||
MOVE_CONSTRUCTOR_FORCED(OutEdgesIterator, out_edge_iterator_t);
|
|
||||||
TRANSFORM_VALUE_ONE(InEdgesIterator, in_edge_iterator_t);
|
|
||||||
MOVE_CONSTRUCTOR_FORCED(InEdgesIterator, in_edge_iterator_t);
|
|
||||||
TRANSFORM_VALUE_ONE(VertexIterator, ::iter::Virtual<const ::VertexAccessor>);
|
|
||||||
MOVE_CONSTRUCTOR_FORCED(VertexIterator,
|
|
||||||
::iter::Virtual<const ::VertexAccessor>);
|
|
||||||
TRANSFORM_VALUE_ONE(EdgeIterator, ::iter::Virtual<const ::EdgeAccessor>);
|
|
||||||
MOVE_CONSTRUCTOR_FORCED(EdgeIterator, ::iter::Virtual<const ::EdgeAccessor>);
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
TRANSFORM_VALUE_ONE_RAW(
|
|
||||||
VertexPropertyType<T>,
|
|
||||||
::VertexPropertyFamily::PropertyType::PropertyTypeKey<T>);
|
|
||||||
template <class T>
|
|
||||||
TRANSFORM_VALUE_ONE_RAW(EdgePropertyType<T>,
|
|
||||||
::EdgePropertyFamily::PropertyType::PropertyTypeKey<T>)
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
TRANSFORM_VALUE_ONE_RAW(RecordStream<T>, ::bolt::RecordStream<T>)
|
|
||||||
|
|
||||||
// ********************* SPECIAL CONSTRUCTORS
|
|
||||||
#define VertexPropertyType_constructor(x) \
|
|
||||||
template <> \
|
|
||||||
template <> \
|
|
||||||
VertexPropertyType<x>::VertexPropertyType( \
|
|
||||||
::VertexPropertyFamily::PropertyType::PropertyTypeKey<x> &&d) \
|
|
||||||
: Sized(std::move(d)) \
|
|
||||||
{ \
|
|
||||||
}
|
|
||||||
INSTANTIATE_FOR_PROPERTY(VertexPropertyType_constructor);
|
|
||||||
|
|
||||||
#define EdgePropertyType_constructor(x) \
|
|
||||||
template <> \
|
|
||||||
template <> \
|
|
||||||
EdgePropertyType<x>::EdgePropertyType( \
|
|
||||||
::EdgePropertyFamily::PropertyType::PropertyTypeKey<x> &&d) \
|
|
||||||
: Sized(std::move(d)) \
|
|
||||||
{ \
|
|
||||||
}
|
|
||||||
INSTANTIATE_FOR_PROPERTY(EdgePropertyType_constructor);
|
|
||||||
|
|
||||||
DbAccessor::DbAccessor(Db &db) : Sized(::DbAccessor(trans(db))) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -105,10 +105,32 @@ public:
|
|||||||
serializer.write_failure(data);
|
serializer.write_failure(data);
|
||||||
chunk();
|
chunk();
|
||||||
}
|
}
|
||||||
// -- BOLT SPECIFIC METHODS -----------------------------------------------
|
|
||||||
|
void write_count(const size_t count)
|
||||||
|
{
|
||||||
|
write_record();
|
||||||
|
write_list_header(1);
|
||||||
|
write(Int64(count));
|
||||||
|
chunk();
|
||||||
|
}
|
||||||
|
|
||||||
void write(const VertexAccessor &vertex) { serializer.write(vertex); }
|
void write(const VertexAccessor &vertex) { serializer.write(vertex); }
|
||||||
|
void write_vertex_record(const VertexAccessor& va)
|
||||||
|
{
|
||||||
|
write_record();
|
||||||
|
write_list_header(1);
|
||||||
|
write(va);
|
||||||
|
chunk();
|
||||||
|
}
|
||||||
|
|
||||||
void write(const EdgeAccessor &edge) { serializer.write(edge); }
|
void write(const EdgeAccessor &edge) { serializer.write(edge); }
|
||||||
|
void write_edge_record(const EdgeAccessor& ea)
|
||||||
|
{
|
||||||
|
write_record();
|
||||||
|
write_list_header(1);
|
||||||
|
write(ea);
|
||||||
|
chunk();
|
||||||
|
}
|
||||||
|
|
||||||
void write(const StoredProperty<TypeGroupEdge> &prop)
|
void write(const StoredProperty<TypeGroupEdge> &prop)
|
||||||
{
|
{
|
||||||
|
@ -20,8 +20,6 @@ public:
|
|||||||
// -- all possible Memgraph's keys --
|
// -- all possible Memgraph's keys --
|
||||||
constexpr const char *COMPILE_CPU_PATH = "compile_cpu_path";
|
constexpr const char *COMPILE_CPU_PATH = "compile_cpu_path";
|
||||||
constexpr const char *TEMPLATE_CPU_CPP_PATH = "template_cpu_cpp_path";
|
constexpr const char *TEMPLATE_CPU_CPP_PATH = "template_cpu_cpp_path";
|
||||||
constexpr const char *BARRIER_TEMPLATE_CPU_CPP_PATH =
|
|
||||||
"barrier_template_cpu_cpp_path";
|
|
||||||
constexpr const char *SNAPSHOTS_PATH = "snapshots_path";
|
constexpr const char *SNAPSHOTS_PATH = "snapshots_path";
|
||||||
constexpr const char *CLEANING_CYCLE_SEC = "cleaning_cycle_sec";
|
constexpr const char *CLEANING_CYCLE_SEC = "cleaning_cycle_sec";
|
||||||
constexpr const char *SNAPSHOT_CYCLE_SEC = "snapshot_cycle_sec";
|
constexpr const char *SNAPSHOT_CYCLE_SEC = "snapshot_cycle_sec";
|
||||||
|
54
include/data_structures/ptr_int.hpp
Normal file
54
include/data_structures/ptr_int.hpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cinttypes>
|
||||||
|
|
||||||
|
#include "utils/numerics/log2.hpp"
|
||||||
|
|
||||||
|
template <typename PtrT>
|
||||||
|
struct PointerPackTraits
|
||||||
|
{
|
||||||
|
// here is a place to embed something like platform specific things
|
||||||
|
// TODO: cover more cases
|
||||||
|
constexpr static int free_bits = utils::log2(alignof(PtrT));
|
||||||
|
|
||||||
|
static auto get_ptr(uintptr_t value) { return (PtrT)(value); }
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename PtrT, int IntBits, typename IntT = unsigned,
|
||||||
|
typename PtrTraits = PointerPackTraits<PtrT>>
|
||||||
|
class PtrInt
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
constexpr static int int_shift = PtrTraits::free_bits - IntBits;
|
||||||
|
constexpr static uintptr_t ptr_mask =
|
||||||
|
~(uintptr_t)(((intptr_t)1 << PtrTraits::free_bits) - 1);
|
||||||
|
constexpr static uintptr_t int_mask =
|
||||||
|
(uintptr_t)(((intptr_t)1 << IntBits) - 1);
|
||||||
|
|
||||||
|
uintptr_t value {0};
|
||||||
|
|
||||||
|
public:
|
||||||
|
PtrInt(PtrT pointer, IntT integer)
|
||||||
|
{
|
||||||
|
set_ptr(pointer);
|
||||||
|
set_int(integer);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto set_ptr(PtrT pointer)
|
||||||
|
{
|
||||||
|
auto integer = static_cast<uintptr_t>(get_int());
|
||||||
|
auto ptr = reinterpret_cast<uintptr_t>(pointer);
|
||||||
|
value = (ptr_mask & ptr) | (integer << int_shift);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto set_int(IntT integer)
|
||||||
|
{
|
||||||
|
auto ptr = reinterpret_cast<uintptr_t>(get_ptr());
|
||||||
|
auto int_shifted = static_cast<uintptr_t>(integer << int_shift);
|
||||||
|
value = (int_mask & int_shifted) | ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto get_ptr() const { return PtrTraits::get_ptr(value & ptr_mask); }
|
||||||
|
|
||||||
|
auto get_int() const { return (IntT)((value >> int_shift) & int_mask); }
|
||||||
|
};
|
@ -49,9 +49,11 @@ class DbAccessor
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
DbAccessor(Db &db);
|
DbAccessor(Db &db);
|
||||||
|
|
||||||
DbAccessor(Db &db, tx::Transaction &t);
|
DbAccessor(Db &db, tx::Transaction &t);
|
||||||
|
|
||||||
|
DbAccessor(const DbAccessor& other) = delete;
|
||||||
|
DbAccessor(DbAccessor&& other) = delete;
|
||||||
|
|
||||||
//*******************VERTEX METHODS
|
//*******************VERTEX METHODS
|
||||||
// Returns iterator of VertexAccessor for all vertices.
|
// Returns iterator of VertexAccessor for all vertices.
|
||||||
// TODO: Implement class specaily for this return
|
// TODO: Implement class specaily for this return
|
||||||
@ -140,6 +142,7 @@ public:
|
|||||||
.template type_key<T>();
|
.template type_key<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool update_indexes();
|
||||||
// ******************** TRANSACTION METHODS
|
// ******************** TRANSACTION METHODS
|
||||||
|
|
||||||
// True if commit was successful, or false if transaction was aborted.
|
// True if commit was successful, or false if transaction was aborted.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "logging/loggable.hpp"
|
||||||
#include "storage/indexes/index_update.hpp"
|
#include "storage/indexes/index_update.hpp"
|
||||||
#include "transactions/transaction.hpp"
|
#include "transactions/transaction.hpp"
|
||||||
|
|
||||||
@ -13,13 +14,23 @@ using index_updates_t = std::vector<IndexUpdate>;
|
|||||||
// its methods.
|
// its methods.
|
||||||
// Also serves as a barrier for calling methods defined public but meant for
|
// Also serves as a barrier for calling methods defined public but meant for
|
||||||
// internal use. That kind of method should request DbTransaction&.
|
// internal use. That kind of method should request DbTransaction&.
|
||||||
class DbTransaction
|
class DbTransaction : public Loggable
|
||||||
{
|
{
|
||||||
friend DbAccessor;
|
friend DbAccessor;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
DbTransaction() = delete;
|
||||||
|
~DbTransaction() = default;
|
||||||
|
|
||||||
|
DbTransaction(const DbTransaction& other) = delete;
|
||||||
|
DbTransaction(DbTransaction&& other) = default;
|
||||||
|
|
||||||
|
DbTransaction &operator=(const DbTransaction &) = delete;
|
||||||
|
DbTransaction &operator=(DbTransaction &&) = default;
|
||||||
|
|
||||||
DbTransaction(Db &db);
|
DbTransaction(Db &db);
|
||||||
DbTransaction(Db &db, tx::Transaction &trans) : db(db), trans(trans) {}
|
DbTransaction(Db &db, tx::Transaction &trans)
|
||||||
|
: Loggable("DbTransaction"), db(db), trans(trans) {}
|
||||||
|
|
||||||
// Global transactional algorithms,operations and general methods meant for
|
// Global transactional algorithms,operations and general methods meant for
|
||||||
// internal use should be here or should be routed through this object.
|
// internal use should be here or should be routed through this object.
|
||||||
@ -48,14 +59,9 @@ public:
|
|||||||
// with call update_indexes
|
// with call update_indexes
|
||||||
template <class TG>
|
template <class TG>
|
||||||
void to_update_index(typename TG::vlist_t *vlist,
|
void to_update_index(typename TG::vlist_t *vlist,
|
||||||
typename TG::record_t *record)
|
typename TG::record_t *record);
|
||||||
{
|
|
||||||
index_updates.push_back(make_index_update(vlist, record));
|
|
||||||
}
|
|
||||||
|
|
||||||
index_updates_t index_updates;
|
index_updates_t index_updates;
|
||||||
|
|
||||||
tx::Transaction &trans;
|
|
||||||
|
|
||||||
Db &db;
|
Db &db;
|
||||||
|
tx::Transaction &trans;
|
||||||
};
|
};
|
||||||
|
@ -5,7 +5,10 @@
|
|||||||
class Loggable
|
class Loggable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Loggable(const std::string& name) : logger(logging::log->logger(name)) {}
|
Loggable(std::string &&name)
|
||||||
|
: logger(logging::log->logger(std::forward<std::string>(name)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
virtual ~Loggable() {}
|
virtual ~Loggable() {}
|
||||||
|
|
||||||
|
@ -76,8 +76,10 @@ public:
|
|||||||
template <class... Args>
|
template <class... Args>
|
||||||
void debug(Args&&... args)
|
void debug(Args&&... args)
|
||||||
{
|
{
|
||||||
|
#ifndef NDEBUG
|
||||||
#ifndef LOG_NO_DEBUG
|
#ifndef LOG_NO_DEBUG
|
||||||
emit<Debug>(std::forward<Args>(args)...);
|
emit<Debug>(std::forward<Args>(args)...);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,13 +14,8 @@ class CypherBackend
|
|||||||
public:
|
public:
|
||||||
CypherBackend() : logger(logging::log->logger("CypherBackend"))
|
CypherBackend() : logger(logging::log->logger("CypherBackend"))
|
||||||
{
|
{
|
||||||
// load template file
|
// load template file
|
||||||
#ifdef BARRIER
|
|
||||||
std::string template_path =
|
|
||||||
CONFIG(config::BARRIER_TEMPLATE_CPU_CPP_PATH);
|
|
||||||
#else
|
|
||||||
std::string template_path = CONFIG(config::TEMPLATE_CPU_CPP_PATH);
|
std::string template_path = CONFIG(config::TEMPLATE_CPU_CPP_PATH);
|
||||||
#endif
|
|
||||||
template_text = utils::read_text(fs::path(template_path));
|
template_text = utils::read_text(fs::path(template_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,11 +41,7 @@ public:
|
|||||||
template_text.str(), {{"class_name", "CodeCPU"},
|
template_text.str(), {{"class_name", "CodeCPU"},
|
||||||
{"stripped_hash", std::to_string(stripped_hash)},
|
{"stripped_hash", std::to_string(stripped_hash)},
|
||||||
{"query", query},
|
{"query", query},
|
||||||
#ifdef BARRIER
|
|
||||||
{"stream", "RecordStream<::io::Socket>"},
|
|
||||||
#else
|
|
||||||
{"stream", type_name<Stream>().to_string()},
|
{"stream", type_name<Stream>().to_string()},
|
||||||
#endif
|
|
||||||
{"code", cpp_traverser.code}});
|
{"code", cpp_traverser.code}});
|
||||||
|
|
||||||
logger.trace("generated code: {}", generated);
|
logger.trace("generated code: {}", generated);
|
||||||
|
@ -33,10 +33,11 @@ public:
|
|||||||
"Unable to execute query (executor returned false)");
|
"Unable to execute query (executor returned false)");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
} catch (CypherLexicalError &e) {
|
||||||
|
logger.error("CypherLexicalError: {}", std::string(e.what()));
|
||||||
|
throw e;
|
||||||
} catch (QueryEngineException &e) {
|
} catch (QueryEngineException &e) {
|
||||||
// in this case something fatal went wrong
|
|
||||||
logger.error("QueryEngineException: {}", std::string(e.what()));
|
logger.error("QueryEngineException: {}", std::string(e.what()));
|
||||||
// return false;
|
|
||||||
throw e;
|
throw e;
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -1,123 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "includes.hpp"
|
|
||||||
|
|
||||||
namespace hardcode
|
|
||||||
{
|
|
||||||
|
|
||||||
// TODO: decouple hashes from the code because hashes could and should be
|
|
||||||
// tested separately
|
|
||||||
|
|
||||||
auto load_dressipi_functions(Db &db)
|
|
||||||
{
|
|
||||||
query_functions_t functions;
|
|
||||||
|
|
||||||
// Query: CREATE (n {garment_id: 1234, garment_category_id: 1}) RETURN n
|
|
||||||
// Hash: 12139093029838549530
|
|
||||||
functions[12139093029838549530u] = [&db](properties_t &&args) {
|
|
||||||
DbAccessor t(db);
|
|
||||||
return t.commit();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Query: CREATE (p:profile {profile_id: 111, partner_id: 55}) RETURN p
|
|
||||||
// Hash: 17158428452166262783
|
|
||||||
functions[17158428452166262783u] = [&db](properties_t &&args) {
|
|
||||||
DbAccessor t(db);
|
|
||||||
return t.commit();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Query: MATCH (g:garment {garment_id: 1234}) SET g:FF RETURN labels(g)
|
|
||||||
// Hash: 11123780635391515946
|
|
||||||
functions[11123780635391515946u] = [&db](properties_t &&args) {
|
|
||||||
DbAccessor t(db);
|
|
||||||
return t.commit();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Query: MATCH (p:profile {profile_id: 111, partner_id: 55})-[s:score]-(g:garment{garment_id: 1234}) SET s.score = 1550 RETURN s.score
|
|
||||||
// Hash: 674581607834128909
|
|
||||||
functions[674581607834128909u] = [&db](properties_t &&args) {
|
|
||||||
DbAccessor t(db);
|
|
||||||
return t.commit();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Query: MATCH (g:garment {garment_id: 3456}) SET g.reveals = 50 RETURN g
|
|
||||||
// Hash: 2839969099736071844
|
|
||||||
functions[2839969099736071844u] = [&db](properties_t &&args) {
|
|
||||||
DbAccessor t(db);
|
|
||||||
return t.commit();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Query: MERGE (g1:garment {garment_id: 1234})-[r:default_outfit]-(g2:garment {garment_id: 2345}) RETURN r
|
|
||||||
// Hash: 3782642357973971504
|
|
||||||
functions[3782642357973971504u] = [&db](properties_t &&args) {
|
|
||||||
DbAccessor t(db);
|
|
||||||
return t.commit();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Query: MERGE (p:profile {profile_id: 111, partner_id: 55})-[s:score]-(g.garment {garment_id: 1234}) SET s.score=1500 RETURN s
|
|
||||||
// Hash: 7871009397157280694
|
|
||||||
functions[7871009397157280694u] = [&db](properties_t &&args) {
|
|
||||||
DbAccessor t(db);
|
|
||||||
return t.commit();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Query: MATCH (p:profile {profile_id: 111, partner_id: 55})-[s:score]-(g.garment {garment_id: 1234}) DELETE s
|
|
||||||
// Hash: 9459600951073026137
|
|
||||||
functions[9459600951073026137u] = [&db](properties_t &&args) {
|
|
||||||
DbAccessor t(db);
|
|
||||||
return t.commit();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Query: MATCH (p:profile {profile_id: 113}) DELETE p
|
|
||||||
// Hash: 6763665709953344106
|
|
||||||
functions[6763665709953344106u] = [&db](properties_t &&args) {
|
|
||||||
DbAccessor t(db);
|
|
||||||
return t.commit();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Query: MATCH (n) DETACH DELETE n
|
|
||||||
// Hash: 4798158026600988079
|
|
||||||
functions[4798158026600988079u] = [&db](properties_t &&args) {
|
|
||||||
DbAccessor t(db);
|
|
||||||
return t.commit();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Query: MATCH (p:profile) RETURN p
|
|
||||||
// Hash: 15599970964909894866
|
|
||||||
functions[15599970964909894866u] = [&db](properties_t &&args) {
|
|
||||||
DbAccessor t(db);
|
|
||||||
return t.commit();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Query: MATCH (g:garment) RETURN COUNT(g)
|
|
||||||
// Hash: 11458306387621940265
|
|
||||||
functions[11458306387621940265u] = [&db](properties_t &&args) {
|
|
||||||
DbAccessor t(db);
|
|
||||||
return t.commit();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Query: MATCH (g:garment {garment_id: 1234}) RETURN g
|
|
||||||
// Hash: 7756609649964321221
|
|
||||||
functions[7756609649964321221u] = [&db](properties_t &&args) {
|
|
||||||
DbAccessor t(db);
|
|
||||||
return t.commit();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Query: MATCH (p:profile {partner_id: 55}) RETURN p
|
|
||||||
// Hash: 17506488413143988006
|
|
||||||
functions[17506488413143988006u] = [&db](properties_t &&args) {
|
|
||||||
DbAccessor t(db);
|
|
||||||
return t.commit();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Query: MATCH (n) RETURN count(n)
|
|
||||||
// Hash: 10510787599699014973
|
|
||||||
functions[10510787599699014973u] = [&db](properties_t &&args) {
|
|
||||||
DbAccessor t(db);
|
|
||||||
return t.commit();
|
|
||||||
};
|
|
||||||
|
|
||||||
return functions;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
#include <iostream>
|
|
||||||
#include <map>
|
|
||||||
#include <map>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <utility>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "communication/bolt/v1/serialization/bolt_serializer.hpp"
|
|
||||||
#include "communication/bolt/v1/serialization/record_stream.hpp"
|
|
||||||
#include "database/db.hpp"
|
|
||||||
#include "database/db.hpp"
|
|
||||||
#include "database/db_accessor.hpp"
|
|
||||||
#include "database/db_accessor.hpp"
|
|
||||||
#include "io/network/socket.hpp"
|
|
||||||
#include "mvcc/id.hpp"
|
|
||||||
#include "query/util.hpp"
|
|
||||||
#include "storage/edge_type/edge_type.hpp"
|
|
||||||
#include "storage/edge_x_vertex.hpp"
|
|
||||||
#include "storage/indexes/index_definition.hpp"
|
|
||||||
#include "storage/label/label.hpp"
|
|
||||||
#include "storage/model/properties/all.hpp"
|
|
||||||
#include "storage/model/properties/property.hpp"
|
|
||||||
#include "utils/border.hpp"
|
|
||||||
#include "utils/iterator/iterator.hpp"
|
|
||||||
#include "utils/iterator/iterator.hpp"
|
|
||||||
#include "utils/option_ptr.hpp"
|
|
||||||
#include "utils/reference_wrapper.hpp"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
namespace hardcode
|
|
||||||
{
|
|
||||||
using query_functions_t =
|
|
||||||
std::map<uint64_t, std::function<bool(properties_t &&)>>;
|
|
||||||
}
|
|
@ -1,25 +1,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "query/strip/stripped.hpp"
|
|
||||||
|
|
||||||
#ifdef BARRIER
|
|
||||||
#include "barrier/barrier.hpp"
|
|
||||||
#include "io/network/socket.hpp"
|
|
||||||
#else
|
|
||||||
#include "communication/communication.hpp"
|
#include "communication/communication.hpp"
|
||||||
#include "database/db.hpp"
|
#include "database/db.hpp"
|
||||||
#include "database/db_accessor.hpp"
|
#include "database/db_accessor.hpp"
|
||||||
#endif
|
#include "query/strip/stripped.hpp"
|
||||||
|
|
||||||
template <typename Stream>
|
template <typename Stream>
|
||||||
class IPlanCPU
|
class IPlanCPU
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#ifdef BARRIER
|
|
||||||
virtual bool run(barrier::Db &db, plan_args_t &args, Stream &stream) = 0;
|
|
||||||
#else
|
|
||||||
virtual bool run(Db &db, plan_args_t &args, Stream &stream) = 0;
|
virtual bool run(Db &db, plan_args_t &args, Stream &stream) = 0;
|
||||||
#endif
|
|
||||||
virtual ~IPlanCPU() {}
|
virtual ~IPlanCPU() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
class Traverser : public ast::AstVisitor
|
class Traverser : public ast::AstVisitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
using uptr = std::unique_ptr<Traverser>;
|
using uptr = std::unique_ptr<Traverser>;
|
||||||
using sptr = std::shared_ptr<Traverser>;
|
using sptr = std::shared_ptr<Traverser>;
|
||||||
|
|
||||||
|
@ -12,14 +12,6 @@
|
|||||||
// execution
|
// execution
|
||||||
// postprocess the results
|
// postprocess the results
|
||||||
|
|
||||||
// BARRIER!
|
|
||||||
#ifdef BARRIER
|
|
||||||
namespace barrier
|
|
||||||
{
|
|
||||||
Db &trans(::Db &ref);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <typename Stream>
|
template <typename Stream>
|
||||||
class ProgramExecutor
|
class ProgramExecutor
|
||||||
{
|
{
|
||||||
@ -29,13 +21,7 @@ public:
|
|||||||
auto execute(QueryProgram<Stream> &program, Db &db, Stream &stream)
|
auto execute(QueryProgram<Stream> &program, Db &db, Stream &stream)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
// TODO: return result of query/code exection
|
|
||||||
#ifdef BARRIER
|
|
||||||
return program.plan->run(barrier::trans(db),
|
|
||||||
program.stripped.arguments, stream);
|
|
||||||
#else
|
|
||||||
return program.plan->run(db, program.stripped.arguments, stream);
|
return program.plan->run(db, program.stripped.arguments, stream);
|
||||||
#endif
|
|
||||||
// TODO: catch more exceptions
|
// TODO: catch more exceptions
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
throw PlanExecutionException("");
|
throw PlanExecutionException("");
|
||||||
|
@ -80,6 +80,7 @@ private:
|
|||||||
// TODO ifdef MEMGRAPH64 problem, how to use this kind
|
// TODO ifdef MEMGRAPH64 problem, how to use this kind
|
||||||
// of ifdef functions?
|
// of ifdef functions?
|
||||||
// uint64_t depends on fnv function
|
// uint64_t depends on fnv function
|
||||||
|
// TODO: faster datastructure
|
||||||
std::unordered_map<uint64_t, sptr_code_lib> code_libs;
|
std::unordered_map<uint64_t, sptr_code_lib> code_libs;
|
||||||
|
|
||||||
QueryPreprocessor preprocessor;
|
QueryPreprocessor preprocessor;
|
||||||
|
@ -9,32 +9,17 @@
|
|||||||
#include "logging/default.hpp"
|
#include "logging/default.hpp"
|
||||||
#include "storage/model/properties/properties.hpp"
|
#include "storage/model/properties/properties.hpp"
|
||||||
#include "storage/model/properties/property.hpp"
|
#include "storage/model/properties/property.hpp"
|
||||||
#include "storage/model/properties/traversers/consolewriter.hpp"
|
#include "storage/model/properties/json_writer.hpp"
|
||||||
#include "storage/model/properties/traversers/jsonwriter.hpp"
|
|
||||||
#include "utils/types/byte.hpp"
|
#include "utils/types/byte.hpp"
|
||||||
#include "utils/exceptions/basic_exception.hpp"
|
#include "utils/exceptions/basic_exception.hpp"
|
||||||
|
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
template <class T>
|
|
||||||
void print_props(const Properties<T> &properties);
|
|
||||||
|
|
||||||
#ifdef NDEBUG
|
|
||||||
#define PRINT_PROPS(_)
|
|
||||||
#else
|
|
||||||
#define PRINT_PROPS(_PROPS_) print_props(_PROPS_);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
void cout_properties(const Properties<T> &properties);
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
void cout_property(const StoredProperty<T> &property);
|
|
||||||
|
|
||||||
// this is a nice way how to avoid multiple definition problem with
|
// this is a nice way how to avoid multiple definition problem with
|
||||||
// headers because it will create a unique namespace for each compilation unit
|
// headers because it will create a unique namespace for each compilation unit
|
||||||
// http://stackoverflow.com/questions/2727582/multiple-definition-in-header-file
|
// http://stackoverflow.com/questions/2727582/multiple-definition-in-header-file
|
||||||
|
// but sometimes that might be a problem
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -61,9 +46,9 @@ std::string code_line(const std::string &format_str, const Args &... args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
using name_properties_t = std::vector<std::pair<std::string, Property>>;
|
using name_properties_t = std::vector<std::pair<std::string, Property>>;
|
||||||
|
using indices_t = std::map<std::string, long>;
|
||||||
|
|
||||||
auto query_properties(const std::map<std::string, int64_t> &indices,
|
auto query_properties(indices_t &indices, properties_t &values)
|
||||||
properties_t &values)
|
|
||||||
{
|
{
|
||||||
name_properties_t properties;
|
name_properties_t properties;
|
||||||
for (auto &property_index : indices) {
|
for (auto &property_index : indices) {
|
||||||
|
@ -2,9 +2,15 @@
|
|||||||
|
|
||||||
#include "mvcc/record.hpp"
|
#include "mvcc/record.hpp"
|
||||||
#include "storage/model/edge_model.hpp"
|
#include "storage/model/edge_model.hpp"
|
||||||
|
#include "utils/string_buffer.hpp"
|
||||||
|
#include "storage/model/properties/json_writer.hpp"
|
||||||
|
#include "utils/handle_write.hpp"
|
||||||
|
|
||||||
class Edge : public mvcc::Record<Edge>
|
class Edge : public mvcc::Record<Edge>
|
||||||
{
|
{
|
||||||
|
using buffer_t = utils::StringBuffer;
|
||||||
|
using props_writer_t = JsonWriter<buffer_t>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class Accessor;
|
class Accessor;
|
||||||
|
|
||||||
@ -19,4 +25,14 @@ public:
|
|||||||
Edge &operator=(Edge &&) = delete;
|
Edge &operator=(Edge &&) = delete;
|
||||||
|
|
||||||
EdgeModel data;
|
EdgeModel data;
|
||||||
|
|
||||||
|
template <typename Stream>
|
||||||
|
void stream_repr(Stream &stream) const
|
||||||
|
{
|
||||||
|
auto props = handle_write<buffer_t, props_writer_t>(data.props);
|
||||||
|
|
||||||
|
stream << "Edge(cre = " << tx.cre() << ", "
|
||||||
|
<< "exp = " << tx.exp() << ", "
|
||||||
|
<< "props = " << props.str() << ")";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
@ -19,8 +19,9 @@ class EdgeAccessor : public RecordAccessor<TypeGroupEdge, EdgeAccessor>
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
using RecordAccessor::RecordAccessor;
|
using RecordAccessor::RecordAccessor;
|
||||||
typedef Edge record_t;
|
|
||||||
typedef EdgeRecord record_list_t;
|
using record_t = Edge;
|
||||||
|
using record_list_t = EdgeRecord;
|
||||||
|
|
||||||
// Removes self and disconects vertices from it.
|
// Removes self and disconects vertices from it.
|
||||||
void remove() const;
|
void remove() const;
|
||||||
@ -34,4 +35,21 @@ public:
|
|||||||
|
|
||||||
// EdgeAccessor doesnt need to be filled
|
// EdgeAccessor doesnt need to be filled
|
||||||
VertexAccessor to() const;
|
VertexAccessor to() const;
|
||||||
|
|
||||||
|
template <typename Stream>
|
||||||
|
void stream_repr(Stream& stream) const
|
||||||
|
{
|
||||||
|
auto from_va = from();
|
||||||
|
auto to_va = to();
|
||||||
|
|
||||||
|
from_va.fill();
|
||||||
|
to_va.fill();
|
||||||
|
|
||||||
|
from_va.stream_repr(stream);
|
||||||
|
stream << '-';
|
||||||
|
this->record->stream_repr(stream);
|
||||||
|
stream << "->";
|
||||||
|
to_va.stream_repr(stream);
|
||||||
|
stream << '\n';
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
auto VertexAccessor::out() const
|
auto VertexAccessor::out() const
|
||||||
{
|
{
|
||||||
DbTransaction &t = this->db;
|
DbTransaction &t = this->db;
|
||||||
|
std::cout << "VA OUT" << std::endl;
|
||||||
|
std::cout << record->data.out.size() << std::endl;
|
||||||
return iter::make_map(iter::make_iter_ref(record->data.out),
|
return iter::make_map(iter::make_iter_ref(record->data.out),
|
||||||
[&](auto e) -> auto { return EdgeAccessor(*e, t); });
|
[&](auto e) -> auto { return EdgeAccessor(*e, t); });
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "mvcc/id.hpp"
|
#include "mvcc/id.hpp"
|
||||||
|
|
||||||
// #include "storage/indexes/index_record.hpp"
|
// #include "storage/indexes/index_record.hpp"
|
||||||
|
#include "logging/loggable.hpp"
|
||||||
#include "storage/garbage/delete_sensitive.hpp"
|
#include "storage/garbage/delete_sensitive.hpp"
|
||||||
#include "storage/indexes/index_definition.hpp"
|
#include "storage/indexes/index_definition.hpp"
|
||||||
#include "utils/border.hpp"
|
#include "utils/border.hpp"
|
||||||
@ -26,13 +27,14 @@ class Transaction;
|
|||||||
// TG type group
|
// TG type group
|
||||||
// K type of key on which records are ordered
|
// K type of key on which records are ordered
|
||||||
template <class TG, class K>
|
template <class TG, class K>
|
||||||
class IndexBase : public DeleteSensitive
|
class IndexBase : public DeleteSensitive, public Loggable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Created with the database
|
// Created with the database
|
||||||
IndexBase(IndexDefinition &&it);
|
IndexBase(IndexDefinition &&it, std::string &&logger_name = "IndexBase");
|
||||||
|
|
||||||
IndexBase(IndexDefinition &&it, const tx::Transaction &t);
|
IndexBase(IndexDefinition &&it, const tx::Transaction &t,
|
||||||
|
std::string &&logger_name = "IndexBase");
|
||||||
|
|
||||||
virtual ~IndexBase(){};
|
virtual ~IndexBase(){};
|
||||||
|
|
||||||
@ -70,6 +72,9 @@ public:
|
|||||||
|
|
||||||
const IndexDefinition &definition() const { return it; }
|
const IndexDefinition &definition() const { return it; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Logger logger;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const IndexDefinition it;
|
const IndexDefinition it;
|
||||||
// Id of transaction which created this index.
|
// Id of transaction which created this index.
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
// #include "storage/label/label.hpp"
|
|
||||||
#include "utils/reference_wrapper.hpp"
|
#include "utils/reference_wrapper.hpp"
|
||||||
|
|
||||||
class Label;
|
class Label;
|
||||||
@ -11,13 +10,13 @@ using label_ref_t = ReferenceWrapper<const Label>;
|
|||||||
class LabelCollection
|
class LabelCollection
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
auto begin() { return _labels.begin(); }
|
auto begin() { return labels_.begin(); }
|
||||||
auto begin() const { return _labels.begin(); }
|
auto begin() const { return labels_.begin(); }
|
||||||
auto cbegin() const { return _labels.begin(); }
|
auto cbegin() const { return labels_.begin(); }
|
||||||
|
|
||||||
auto end() { return _labels.end(); }
|
auto end() { return labels_.end(); }
|
||||||
auto end() const { return _labels.end(); }
|
auto end() const { return labels_.end(); }
|
||||||
auto cend() const { return _labels.end(); }
|
auto cend() const { return labels_.end(); }
|
||||||
|
|
||||||
bool add(const Label &label);
|
bool add(const Label &label);
|
||||||
bool has(const Label &label) const;
|
bool has(const Label &label) const;
|
||||||
@ -26,6 +25,13 @@ public:
|
|||||||
void clear();
|
void clear();
|
||||||
const std::vector<label_ref_t> &operator()() const;
|
const std::vector<label_ref_t> &operator()() const;
|
||||||
|
|
||||||
|
template <class Handler>
|
||||||
|
void handle(Handler &handler) const
|
||||||
|
{
|
||||||
|
for (auto &label : labels_)
|
||||||
|
handler.handle(label.get());
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<label_ref_t> _labels;
|
std::vector<label_ref_t> labels_;
|
||||||
};
|
};
|
||||||
|
23
include/storage/label/labels_writer.hpp
Normal file
23
include/storage/label/labels_writer.hpp
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
class Label;
|
||||||
|
|
||||||
|
template <class Buffer>
|
||||||
|
class LabelsWriter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LabelsWriter(Buffer &buffer) : buffer_(buffer) {}
|
||||||
|
|
||||||
|
~LabelsWriter() = default;
|
||||||
|
|
||||||
|
LabelsWriter(const LabelsWriter &) = delete;
|
||||||
|
LabelsWriter(LabelsWriter &&) = delete;
|
||||||
|
|
||||||
|
LabelsWriter &operator=(const LabelsWriter &) = delete;
|
||||||
|
LabelsWriter &operator=(LabelsWriter &&) = delete;
|
||||||
|
|
||||||
|
void handle(const Label& label);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Buffer& buffer_;
|
||||||
|
};
|
@ -16,7 +16,7 @@ public:
|
|||||||
auto end() const { return edges.end(); }
|
auto end() const { return edges.end(); }
|
||||||
auto cend() const { return edges.end(); }
|
auto cend() const { return edges.end(); }
|
||||||
|
|
||||||
void add(EdgeRecord *edge) { edges.push_back(edge); }
|
void add(EdgeRecord *edge) { edges.emplace_back(edge); }
|
||||||
|
|
||||||
size_t degree() const { return edges.size(); }
|
size_t degree() const { return edges.size(); }
|
||||||
|
|
||||||
|
@ -70,30 +70,3 @@ private:
|
|||||||
bool first{true};
|
bool first{true};
|
||||||
Buffer &buffer;
|
Buffer &buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
class StringBuffer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
StringBuffer &operator<<(const std::string &str)
|
|
||||||
{
|
|
||||||
data += str;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuffer &operator<<(const char *str)
|
|
||||||
{
|
|
||||||
data += str;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuffer &operator<<(char c)
|
|
||||||
{
|
|
||||||
data += c;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string &str() { return data; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::string data;
|
|
||||||
};
|
|
@ -1,72 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include "storage/model/properties/properties.hpp"
|
|
||||||
#include "storage/type_group_edge.hpp"
|
|
||||||
#include "storage/type_group_vertex.hpp"
|
|
||||||
|
|
||||||
using std::cout;
|
|
||||||
using std::endl;
|
|
||||||
|
|
||||||
class ConsoleWriter
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ConsoleWriter() {}
|
|
||||||
|
|
||||||
void handle(const StoredProperty<TypeGroupEdge> &value)
|
|
||||||
{
|
|
||||||
handle<TypeGroupEdge>(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void handle(const StoredProperty<TypeGroupVertex> &value)
|
|
||||||
{
|
|
||||||
handle<TypeGroupVertex>(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
void handle(StoredProperty<T> const &value)
|
|
||||||
{
|
|
||||||
cout << "KEY: " << value.key.family_name() << "; VALUE: ";
|
|
||||||
|
|
||||||
value.accept(*this);
|
|
||||||
|
|
||||||
// value.accept(*this);
|
|
||||||
|
|
||||||
cout << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void handle(const Null &v) { cout << "NULL"; }
|
|
||||||
|
|
||||||
void handle(const Bool &b) { cout << b; }
|
|
||||||
|
|
||||||
void handle(const String &s) { cout << s; }
|
|
||||||
|
|
||||||
void handle(const Int32 &int32) { cout << int32; }
|
|
||||||
|
|
||||||
void handle(const Int64 &int64) { cout << int64; }
|
|
||||||
|
|
||||||
void handle(const Float &f) { cout << f; }
|
|
||||||
|
|
||||||
void handle(const Double &d) { cout << d; }
|
|
||||||
|
|
||||||
// Not yet implemented
|
|
||||||
void handle(const ArrayBool &) { assert(false); }
|
|
||||||
|
|
||||||
// Not yet implemented
|
|
||||||
void handle(const ArrayInt32 &) { assert(false); }
|
|
||||||
|
|
||||||
// Not yet implemented
|
|
||||||
void handle(const ArrayInt64 &) { assert(false); }
|
|
||||||
|
|
||||||
// Not yet implemented
|
|
||||||
void handle(const ArrayFloat &) { assert(false); }
|
|
||||||
|
|
||||||
// Not yet implemented
|
|
||||||
void handle(const ArrayDouble &) { assert(false); }
|
|
||||||
|
|
||||||
// Not yet implemented
|
|
||||||
void handle(const ArrayString &) { assert(false); }
|
|
||||||
|
|
||||||
void finish() {}
|
|
||||||
};
|
|
@ -1,11 +1,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "mvcc/record.hpp"
|
#include "mvcc/record.hpp"
|
||||||
#include "storage/model/properties/traversers/jsonwriter.hpp"
|
#include "storage/label/labels_writer.hpp"
|
||||||
|
#include "storage/model/properties/json_writer.hpp"
|
||||||
#include "storage/model/vertex_model.hpp"
|
#include "storage/model/vertex_model.hpp"
|
||||||
|
#include "utils/handle_write.hpp"
|
||||||
|
#include "utils/string_buffer.hpp"
|
||||||
|
|
||||||
class Vertex : public mvcc::Record<Vertex>
|
class Vertex : public mvcc::Record<Vertex>
|
||||||
{
|
{
|
||||||
|
using buffer_t = utils::StringBuffer;
|
||||||
|
using props_writer_t = JsonWriter<buffer_t>;
|
||||||
|
using labels_writer_t = LabelsWriter<buffer_t>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class Accessor;
|
class Accessor;
|
||||||
|
|
||||||
@ -14,24 +21,22 @@ public:
|
|||||||
Vertex(VertexModel &&data) : data(std::move(data)) {}
|
Vertex(VertexModel &&data) : data(std::move(data)) {}
|
||||||
|
|
||||||
Vertex(const Vertex &) = delete;
|
Vertex(const Vertex &) = delete;
|
||||||
Vertex(Vertex &&) = delete;
|
Vertex(Vertex &&) = delete;
|
||||||
|
|
||||||
Vertex &operator=(const Vertex &) = delete;
|
Vertex &operator=(const Vertex &) = delete;
|
||||||
Vertex &operator=(Vertex &&) = delete;
|
Vertex &operator=(Vertex &&) = delete;
|
||||||
|
|
||||||
VertexModel data;
|
VertexModel data;
|
||||||
|
|
||||||
|
template <typename Stream>
|
||||||
|
void stream_repr(Stream &stream) const
|
||||||
|
{
|
||||||
|
auto props = handle_write<buffer_t, props_writer_t>(data.props);
|
||||||
|
auto labels = handle_write<buffer_t, labels_writer_t>(data.labels);
|
||||||
|
|
||||||
|
stream << "Vertex(cre = " << tx.cre() << ", "
|
||||||
|
<< "exp = " << tx.exp() << ", "
|
||||||
|
<< "props = " << props.str() << ", "
|
||||||
|
<< "labels = " << labels.str() << ")";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::ostream &operator<<(std::ostream &stream, const Vertex &record)
|
|
||||||
{
|
|
||||||
StringBuffer buffer;
|
|
||||||
JsonWriter<StringBuffer> writer(buffer);
|
|
||||||
|
|
||||||
// dump properties in this buffer
|
|
||||||
record.data.props.handle(writer);
|
|
||||||
writer.finish();
|
|
||||||
|
|
||||||
return stream << "Vertex"
|
|
||||||
<< "(cre = " << record.tx.cre()
|
|
||||||
<< ", exp = " << record.tx.exp() << "): " << buffer.str();
|
|
||||||
}
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "storage/label/label_collection.hpp"
|
||||||
#include "storage/record_accessor.hpp"
|
#include "storage/record_accessor.hpp"
|
||||||
#include "storage/vertex.hpp"
|
#include "storage/vertex.hpp"
|
||||||
#include "utils/iterator/iterator.hpp"
|
#include "utils/iterator/iterator.hpp"
|
||||||
@ -15,7 +16,7 @@ class VertexAccessor : public RecordAccessor<TypeGroupVertex, VertexAccessor>
|
|||||||
public:
|
public:
|
||||||
using RecordAccessor::RecordAccessor;
|
using RecordAccessor::RecordAccessor;
|
||||||
|
|
||||||
using record_t = Vertex;
|
using record_t = Vertex;
|
||||||
using record_list_t = VertexRecord;
|
using record_list_t = VertexRecord;
|
||||||
|
|
||||||
// Removes self and all edges connected to it.
|
// Removes self and all edges connected to it.
|
||||||
@ -51,4 +52,13 @@ public:
|
|||||||
|
|
||||||
// True if there exists edge between other vertex and this vertex.
|
// True if there exists edge between other vertex and this vertex.
|
||||||
bool in_contains(VertexAccessor const &other) const;
|
bool in_contains(VertexAccessor const &other) const;
|
||||||
|
|
||||||
|
template <typename Stream>
|
||||||
|
void stream_repr(Stream& stream) const
|
||||||
|
{
|
||||||
|
if (!this->record)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this->record->stream_repr(stream);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
16
include/utils/handle_write.hpp
Normal file
16
include/utils/handle_write.hpp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Source object is going to be traversed by Writer and Writer will
|
||||||
|
* write that data into the Destination object.
|
||||||
|
*
|
||||||
|
* Writer object defines write format.
|
||||||
|
*/
|
||||||
|
template <typename Destination, typename Writer, typename Source>
|
||||||
|
Destination handle_write(const Source& source)
|
||||||
|
{
|
||||||
|
Destination destination;
|
||||||
|
Writer writter(destination);
|
||||||
|
source.handle(writter);
|
||||||
|
return destination;
|
||||||
|
}
|
@ -6,7 +6,8 @@
|
|||||||
namespace iter
|
namespace iter
|
||||||
{
|
{
|
||||||
|
|
||||||
// Class which Combined two iterators IT1 and IT2. Both return values T
|
// Class which Combined two iterators IT1 and IT2.
|
||||||
|
// Both return values T
|
||||||
// T - type of return value
|
// T - type of return value
|
||||||
// IT1 - first iterator type
|
// IT1 - first iterator type
|
||||||
// IT2 - second iterator type
|
// IT2 - second iterator type
|
||||||
|
@ -116,6 +116,12 @@ public:
|
|||||||
move(), [](auto vr) { return vr.out().fill(); });
|
move(), [](auto vr) { return vr.out().fill(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto in()
|
||||||
|
{
|
||||||
|
return iter::make_flat_map<Derived>(
|
||||||
|
move(), [](auto vr) { return vr.in().fill(); });
|
||||||
|
}
|
||||||
|
|
||||||
// Filters with label on from vertex.
|
// Filters with label on from vertex.
|
||||||
template <class LABEL>
|
template <class LABEL>
|
||||||
auto from_label(LABEL const &label)
|
auto from_label(LABEL const &label)
|
||||||
@ -153,6 +159,12 @@ public:
|
|||||||
move(), [&](auto &v) mutable { t = Option<const T>(v); });
|
move(), [&](auto &v) mutable { t = Option<const T>(v); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// auto clone_to(Option<T> &t)
|
||||||
|
// {
|
||||||
|
// return iter::make_inspect<Derived>(
|
||||||
|
// move(), [&](auto &e) mutable { t = Option<T>(e); });
|
||||||
|
// }
|
||||||
|
|
||||||
// Filters with call to method fill()
|
// Filters with call to method fill()
|
||||||
auto fill()
|
auto fill()
|
||||||
{
|
{
|
||||||
|
@ -6,27 +6,31 @@
|
|||||||
namespace iter
|
namespace iter
|
||||||
{
|
{
|
||||||
|
|
||||||
// Class which inspects values returned by I iterator before passing thenm as
|
// Class which inspects values returned by I iterator
|
||||||
// result.
|
// before passing them as a result.
|
||||||
// function.
|
// function.
|
||||||
// T - type of return value
|
// T - type of return value
|
||||||
// I - iterator type
|
// I - iterator type
|
||||||
// OP - type of inspector function. OP: T&->void
|
// OP - type of inspector function. OP: T&->void
|
||||||
template <class T, class I, class OP>
|
template <class T, class I, class OP>
|
||||||
class Inspect : public IteratorBase<T>, public Composable<T, Inspect<T, I, OP>>
|
class Inspect : public IteratorBase<T>,
|
||||||
|
public Composable<T, Inspect<T, I, OP>>
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Inspect() = delete;
|
Inspect() = delete;
|
||||||
|
|
||||||
// Inspect operation is designed to be used in chained calls which operate
|
// Inspect operation is designed to be used
|
||||||
// on a
|
// in chained calls which operate on an
|
||||||
// iterator. Inspect will in that usecase receive other iterator by value
|
// iterator. Inspect will in that usecase
|
||||||
// and
|
// receive other iterator by value and
|
||||||
// std::move is a optimization for it.
|
// std::move is a optimization for it.
|
||||||
Inspect(I &&iter, OP &&op) : iter(std::move(iter)), op(std::move(op)) {}
|
Inspect(I &&iter, OP &&op) :
|
||||||
|
iter(std::move(iter)),
|
||||||
|
op(std::move(op))
|
||||||
|
{}
|
||||||
|
|
||||||
Inspect(Inspect &&m) : iter(std::move(m.iter)), op(std::move(m.op)) {}
|
Inspect(Inspect &&m) :
|
||||||
|
iter(std::move(m.iter)), op(std::move(m.op)) {}
|
||||||
|
|
||||||
~Inspect() final {}
|
~Inspect() final {}
|
||||||
|
|
||||||
@ -52,7 +56,7 @@ template <class I, class OP>
|
|||||||
auto make_inspect(I &&iter, OP &&op)
|
auto make_inspect(I &&iter, OP &&op)
|
||||||
{
|
{
|
||||||
// Compiler cant deduce type T. decltype is here to help with it.
|
// Compiler cant deduce type T. decltype is here to help with it.
|
||||||
return Inspect<decltype(iter.next().take()), I, OP>(std::move(iter),
|
return Inspect<decltype(iter.next().take()), I, OP>
|
||||||
std::move(op));
|
(std::move(iter), std::move(op));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "query_engine/exceptions/exceptions.hpp"
|
|
||||||
|
#include "utils/exceptions/out_of_memory.hpp"
|
||||||
#include "utils/memory/block_allocator.hpp"
|
#include "utils/memory/block_allocator.hpp"
|
||||||
|
|
||||||
// http://en.cppreference.com/w/cpp/language/new
|
// http://en.cppreference.com/w/cpp/language/new
|
||||||
@ -24,7 +25,8 @@ public:
|
|||||||
// until it eats all the memory.
|
// until it eats all the memory.
|
||||||
static_assert(sizeof(T) <= page_size,
|
static_assert(sizeof(T) <= page_size,
|
||||||
"Cant allocate objects larger than page_size");
|
"Cant allocate objects larger than page_size");
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
// Mask which has log2(alignof(T)) lower bits setted to 0 and the
|
// Mask which has log2(alignof(T)) lower bits setted to 0 and the
|
||||||
// rest to 1.
|
// rest to 1.
|
||||||
// example:
|
// example:
|
||||||
@ -56,7 +58,8 @@ public:
|
|||||||
|
|
||||||
// If the new_head is greater than end that means that there isn't
|
// If the new_head is greater than end that means that there isn't
|
||||||
// enough space for object T in current block of memory.
|
// enough space for object T in current block of memory.
|
||||||
if (LIKELY(new_head <= end)) {
|
if (LIKELY(new_head <= end))
|
||||||
|
{
|
||||||
|
|
||||||
// All is fine, head can become new_head
|
// All is fine, head can become new_head
|
||||||
head = new_head;
|
head = new_head;
|
||||||
@ -99,7 +102,8 @@ public:
|
|||||||
// Relases all memory.
|
// Relases all memory.
|
||||||
void free()
|
void free()
|
||||||
{
|
{
|
||||||
while (allocated_blocks.size() > 0) {
|
while (allocated_blocks.size())
|
||||||
|
{
|
||||||
blocks.release(allocated_blocks.back());
|
blocks.release(allocated_blocks.back());
|
||||||
allocated_blocks.pop_back();
|
allocated_blocks.pop_back();
|
||||||
}
|
}
|
||||||
@ -109,5 +113,5 @@ private:
|
|||||||
BlockAllocator<page_size> blocks;
|
BlockAllocator<page_size> blocks;
|
||||||
std::vector<void *> allocated_blocks;
|
std::vector<void *> allocated_blocks;
|
||||||
char *head = {nullptr};
|
char *head = {nullptr};
|
||||||
char *end = {nullptr};
|
char *end = {nullptr};
|
||||||
};
|
};
|
||||||
|
10
include/utils/numerics/log2.hpp
Normal file
10
include/utils/numerics/log2.hpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
namespace utils
|
||||||
|
{
|
||||||
|
|
||||||
|
constexpr size_t log2(size_t n) { return ((n < 2) ? 0 : 1 + log2(n >> 1)); }
|
||||||
|
|
||||||
|
}
|
@ -5,7 +5,8 @@
|
|||||||
#include <ext/aligned_buffer.h>
|
#include <ext/aligned_buffer.h>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
// Optional object storage. It maybe has and maybe dosent have objet of type T.
|
// Optional object storage. It maybe has and maybe
|
||||||
|
// dosent have objet of type T.
|
||||||
template <class T>
|
template <class T>
|
||||||
class Option
|
class Option
|
||||||
{
|
{
|
||||||
@ -33,12 +34,14 @@ public:
|
|||||||
std::memset(data._M_addr(), 0, sizeof(T));
|
std::memset(data._M_addr(), 0, sizeof(T));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Containers from std which have strong exception guarantees wont use move
|
|
||||||
// constructors and operators wihtout noexcept. "Optimized C++,2016 , Kurt
|
// Containers from std which have strong exception
|
||||||
// Guntheroth, page: 142, title: Moving instances into std::vector"
|
// guarantees wont use move constructors and operators
|
||||||
|
// wihtout noexcept. "Optimized C++,2016 , Kurt
|
||||||
|
// Guntheroth, page: 142, title: Moving instances into
|
||||||
|
// std::vector"
|
||||||
Option(Option &&other) noexcept
|
Option(Option &&other) noexcept
|
||||||
{
|
{
|
||||||
|
|
||||||
if (other.initialized) {
|
if (other.initialized) {
|
||||||
new (data._M_addr()) T(std::move(other.get()));
|
new (data._M_addr()) T(std::move(other.get()));
|
||||||
other.initialized = false;
|
other.initialized = false;
|
||||||
@ -69,6 +72,7 @@ public:
|
|||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Option &operator=(Option &&other)
|
Option &operator=(Option &&other)
|
||||||
{
|
{
|
||||||
if (initialized) {
|
if (initialized) {
|
||||||
@ -180,8 +184,9 @@ public:
|
|||||||
explicit operator bool() const { return initialized; }
|
explicit operator bool() const { return initialized; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Aligned buffer is here to ensure aligment for data of type T. It isn't
|
// Aligned buffer is here to ensure aligment for
|
||||||
// applicable to just put T field because the field has to be able to be
|
// data of type T. It isn't applicable to just put T
|
||||||
|
// field because the field has to be able to be
|
||||||
// uninitialized to fulfill the semantics of Option class.
|
// uninitialized to fulfill the semantics of Option class.
|
||||||
__gnu_cxx::__aligned_buffer<T> data;
|
__gnu_cxx::__aligned_buffer<T> data;
|
||||||
bool initialized = false;
|
bool initialized = false;
|
||||||
|
54
include/utils/string_buffer.hpp
Normal file
54
include/utils/string_buffer.hpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace utils
|
||||||
|
{
|
||||||
|
|
||||||
|
class StringBuffer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
StringBuffer() = default;
|
||||||
|
~StringBuffer() = default;
|
||||||
|
|
||||||
|
StringBuffer(const StringBuffer &) = delete;
|
||||||
|
StringBuffer(StringBuffer &&) = default;
|
||||||
|
|
||||||
|
StringBuffer &operator=(const StringBuffer &) = delete;
|
||||||
|
StringBuffer &operator=(StringBuffer &&) = default;
|
||||||
|
|
||||||
|
StringBuffer(std::string::size_type count)
|
||||||
|
{
|
||||||
|
resize(count);
|
||||||
|
}
|
||||||
|
|
||||||
|
void resize(std::string::size_type count)
|
||||||
|
{
|
||||||
|
data.resize(count);
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuffer &operator<<(const std::string &str)
|
||||||
|
{
|
||||||
|
data += str;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuffer &operator<<(const char *str)
|
||||||
|
{
|
||||||
|
data += str;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuffer &operator<<(char c)
|
||||||
|
{
|
||||||
|
data += c;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string &str() { return data; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string data;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@ -9,11 +9,11 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "communication/bolt/v1/serialization/bolt_serializer.hpp"
|
||||||
#include "data_structures/map/rh_hashmap.hpp"
|
#include "data_structures/map/rh_hashmap.hpp"
|
||||||
#include "database/db.hpp"
|
#include "database/db.hpp"
|
||||||
#include "database/db_accessor.cpp"
|
#include "database/db_accessor.cpp"
|
||||||
#include "database/db_accessor.hpp"
|
#include "database/db_accessor.hpp"
|
||||||
|
|
||||||
#include "import/csv_import.hpp"
|
#include "import/csv_import.hpp"
|
||||||
#include "logging/default.hpp"
|
#include "logging/default.hpp"
|
||||||
#include "logging/streams/stdout.hpp"
|
#include "logging/streams/stdout.hpp"
|
||||||
@ -23,8 +23,6 @@
|
|||||||
#include "storage/indexes/impl/nonunique_unordered_index.cpp"
|
#include "storage/indexes/impl/nonunique_unordered_index.cpp"
|
||||||
#include "storage/model/properties/properties.cpp"
|
#include "storage/model/properties/properties.cpp"
|
||||||
#include "storage/record_accessor.cpp"
|
#include "storage/record_accessor.cpp"
|
||||||
// #include "storage/vertex_accessor.cpp"
|
|
||||||
#include "communication/bolt/v1/serialization/bolt_serializer.hpp"
|
|
||||||
#include "storage/vertex_accessor.hpp"
|
#include "storage/vertex_accessor.hpp"
|
||||||
#include "storage/vertices.cpp"
|
#include "storage/vertices.cpp"
|
||||||
#include "storage/vertices.hpp"
|
#include "storage/vertices.hpp"
|
||||||
@ -60,9 +58,10 @@ public:
|
|||||||
|
|
||||||
double sum_vertex_score()
|
double sum_vertex_score()
|
||||||
{
|
{
|
||||||
auto now = this;
|
auto now = this;
|
||||||
double sum = 0;
|
double sum = 0;
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
sum += (now->vacc.at(tkey).get())->value();
|
sum += (now->vacc.at(tkey).get())->value();
|
||||||
now = now->parent;
|
now = now->parent;
|
||||||
} while (now != nullptr);
|
} while (now != nullptr);
|
||||||
@ -84,8 +83,11 @@ void found_result(Node *res)
|
|||||||
|
|
||||||
std::cout << "{score: " << sum << endl;
|
std::cout << "{score: " << sum << endl;
|
||||||
auto bef = res;
|
auto bef = res;
|
||||||
while (bef != nullptr) {
|
while (bef != nullptr)
|
||||||
std::cout << " " << *(bef->vacc.operator->()) << endl;
|
{
|
||||||
|
std::cout << " ";
|
||||||
|
bef->vacc.operator->()->stream_repr(std::cout);
|
||||||
|
std::cout << std::endl;
|
||||||
bef = bef->parent;
|
bef = bef->parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,18 +115,23 @@ bool vertex_filter_dummy(DbAccessor &t, VertexAccessor &va, Node *before)
|
|||||||
bool vertex_filter_contained_dummy(DbAccessor &t, VertexAccessor &v,
|
bool vertex_filter_contained_dummy(DbAccessor &t, VertexAccessor &v,
|
||||||
Node *before)
|
Node *before)
|
||||||
{
|
{
|
||||||
if (v.fill()) {
|
if (v.fill())
|
||||||
|
{
|
||||||
bool found;
|
bool found;
|
||||||
do {
|
do
|
||||||
found = false;
|
{
|
||||||
|
found = false;
|
||||||
before = before->parent;
|
before = before->parent;
|
||||||
if (before == nullptr) {
|
if (before == nullptr)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
auto it = before->vacc.out();
|
auto it = before->vacc.out();
|
||||||
for (auto e = it.next(); e.is_present(); e = it.next()) {
|
for (auto e = it.next(); e.is_present(); e = it.next())
|
||||||
|
{
|
||||||
VertexAccessor va = e.get().to();
|
VertexAccessor va = e.get().to();
|
||||||
if (va == v) {
|
if (va == v)
|
||||||
|
{
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -136,12 +143,15 @@ bool vertex_filter_contained_dummy(DbAccessor &t, VertexAccessor &v,
|
|||||||
|
|
||||||
bool vertex_filter_contained(DbAccessor &t, VertexAccessor &v, Node *before)
|
bool vertex_filter_contained(DbAccessor &t, VertexAccessor &v, Node *before)
|
||||||
{
|
{
|
||||||
if (v.fill()) {
|
if (v.fill())
|
||||||
|
{
|
||||||
bool found;
|
bool found;
|
||||||
do {
|
do
|
||||||
found = false;
|
{
|
||||||
|
found = false;
|
||||||
before = before->parent;
|
before = before->parent;
|
||||||
if (before == nullptr) {
|
if (before == nullptr)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} while (v.in_contains(before->vacc));
|
} while (v.in_contains(before->vacc));
|
||||||
@ -163,7 +173,9 @@ auto a_star(
|
|||||||
DbAccessor t(db);
|
DbAccessor t(db);
|
||||||
|
|
||||||
type_key_t<TypeGroupVertex, Double> type_key =
|
type_key_t<TypeGroupVertex, Double> type_key =
|
||||||
t.vertex_property_family_get("score").get(Flags::Double).type_key<Double>();
|
t.vertex_property_family_get("score")
|
||||||
|
.get(Flags::Double)
|
||||||
|
.type_key<Double>();
|
||||||
|
|
||||||
auto best_found = new std::map<Id, Score>[max_depth];
|
auto best_found = new std::map<Id, Score>[max_depth];
|
||||||
|
|
||||||
@ -177,17 +189,20 @@ auto a_star(
|
|||||||
Node *start = new Node(start_vr.take(), 0, type_key);
|
Node *start = new Node(start_vr.take(), 0, type_key);
|
||||||
queue.push(start);
|
queue.push(start);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
auto now = queue.top();
|
auto now = queue.top();
|
||||||
queue.pop();
|
queue.pop();
|
||||||
// if(!visited.insert(now)){
|
// if(!visited.insert(now)){
|
||||||
// continue;
|
// continue;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (max_depth <= now->depth) {
|
if (max_depth <= now->depth)
|
||||||
|
{
|
||||||
best.push_back(now);
|
best.push_back(now);
|
||||||
count++;
|
count++;
|
||||||
if (count >= limit) {
|
if (count >= limit)
|
||||||
|
{
|
||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -202,11 +217,13 @@ auto a_star(
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
iter::for_all(now->vacc.out(), [&](auto edge) {
|
iter::for_all(now->vacc.out(), [&](auto edge) {
|
||||||
if (e_filter[now->depth](t, edge, now)) {
|
if (e_filter[now->depth](t, edge, now))
|
||||||
|
{
|
||||||
VertexAccessor va = edge.to();
|
VertexAccessor va = edge.to();
|
||||||
if (v_filter[now->depth](t, va, now)) {
|
if (v_filter[now->depth](t, va, now))
|
||||||
|
{
|
||||||
auto cost = calc_heuristic_cost(type_key, edge, va);
|
auto cost = calc_heuristic_cost(type_key, edge, va);
|
||||||
Node *n = new Node(va, now->cost + cost, now, type_key);
|
Node *n = new Node(va, now->cost + cost, now, type_key);
|
||||||
queue.push(n);
|
queue.push(n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -238,15 +255,16 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
// CONF
|
// CONF
|
||||||
std::srand(time(0));
|
std::srand(time(0));
|
||||||
auto best_n = 10;
|
auto best_n = 10;
|
||||||
auto bench_n = 1000;
|
auto bench_n = 1000;
|
||||||
auto best_print_n = 10;
|
auto best_print_n = 10;
|
||||||
bool pick_best_found =
|
bool pick_best_found =
|
||||||
strcmp(get_argument(para, "-p", "true").c_str(), "true") == 0;
|
strcmp(get_argument(para, "-p", "true").c_str(), "true") == 0;
|
||||||
|
|
||||||
double sum = 0;
|
double sum = 0;
|
||||||
std::vector<Node *> best;
|
std::vector<Node *> best;
|
||||||
for (int i = 0; i < bench_n; i++) {
|
for (int i = 0; i < bench_n; i++)
|
||||||
|
{
|
||||||
auto start_vertex_index = std::rand() % loaded.first;
|
auto start_vertex_index = std::rand() % loaded.first;
|
||||||
|
|
||||||
auto begin = clock();
|
auto begin = clock();
|
||||||
@ -260,12 +278,14 @@ int main(int argc, char **argv)
|
|||||||
if ((best.size() < best_print_n && found.size() > best.size()) ||
|
if ((best.size() < best_print_n && found.size() > best.size()) ||
|
||||||
(pick_best_found && found.size() > 0 &&
|
(pick_best_found && found.size() > 0 &&
|
||||||
found.front()->sum_vertex_score() >
|
found.front()->sum_vertex_score() >
|
||||||
best.front()->sum_vertex_score())) {
|
best.front()->sum_vertex_score()))
|
||||||
|
{
|
||||||
best = found;
|
best = found;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Just to be safe
|
// Just to be safe
|
||||||
if (i + 1 == bench_n && best.size() == 0) {
|
if (i + 1 == bench_n && best.size() == 0)
|
||||||
|
{
|
||||||
bench_n++;
|
bench_n++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -274,7 +294,8 @@ int main(int argc, char **argv)
|
|||||||
<< " results has runing time of:\n avg: " << sum / bench_n
|
<< " results has runing time of:\n avg: " << sum / bench_n
|
||||||
<< " [ms]\n";
|
<< " [ms]\n";
|
||||||
std::cout << "\nExample of best result:\n";
|
std::cout << "\nExample of best result:\n";
|
||||||
for (int i = 0; i < best_print_n && best.size() > 0; i++) {
|
for (int i = 0; i < best_print_n && best.size() > 0; i++)
|
||||||
|
{
|
||||||
found_result(best.front());
|
found_result(best.front());
|
||||||
best.erase(best.begin());
|
best.erase(best.begin());
|
||||||
}
|
}
|
||||||
@ -292,7 +313,8 @@ void add_scores(Db &db)
|
|||||||
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
iter::for_all(t.vertex_access(), [&](auto v) {
|
iter::for_all(t.vertex_access(), [&](auto v) {
|
||||||
if (v.fill()) {
|
if (v.fill())
|
||||||
|
{
|
||||||
// any random number is OK
|
// any random number is OK
|
||||||
std::srand(i ^ 0x7482616);
|
std::srand(i ^ 0x7482616);
|
||||||
v.set(StoredProperty<TypeGroupVertex>(
|
v.set(StoredProperty<TypeGroupVertex>(
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
#include "queries/astar.cpp"
|
|
||||||
|
|
||||||
#include "barrier/barrier.cpp"
|
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
@ -21,6 +17,7 @@
|
|||||||
#include "import/csv_import.hpp"
|
#include "import/csv_import.hpp"
|
||||||
#include "logging/default.hpp"
|
#include "logging/default.hpp"
|
||||||
#include "logging/streams/stdout.hpp"
|
#include "logging/streams/stdout.hpp"
|
||||||
|
#include "queries/astar.hpp"
|
||||||
#include "storage/edge_x_vertex.hpp"
|
#include "storage/edge_x_vertex.hpp"
|
||||||
#include "storage/edges.cpp"
|
#include "storage/edges.cpp"
|
||||||
#include "storage/edges.hpp"
|
#include "storage/edges.hpp"
|
||||||
@ -41,21 +38,23 @@ int main(int argc, char **argv)
|
|||||||
auto para = all_arguments(argc, argv);
|
auto para = all_arguments(argc, argv);
|
||||||
|
|
||||||
Db db("astar");
|
Db db("astar");
|
||||||
barrier::CodeCPU cp;
|
PlanCPU plan;
|
||||||
int bench_n = 1000;
|
int bench_n = 1000;
|
||||||
|
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
double sum = 0;
|
double sum = 0;
|
||||||
for (int i = 0; i < bench_n; i++) {
|
for (int i = 0; i < bench_n; i++)
|
||||||
|
{
|
||||||
auto start_vertex_index =
|
auto start_vertex_index =
|
||||||
std::rand() % db.graph.vertices.access().size();
|
std::rand() % db.graph.vertices.access().size();
|
||||||
|
|
||||||
auto begin = clock();
|
auto begin = clock();
|
||||||
|
|
||||||
code_args_t args;
|
plan_args_t args;
|
||||||
args.push_back(Property(Int64(start_vertex_index), Int64::type));
|
args.push_back(Property(Int64(start_vertex_index), Int64::type));
|
||||||
|
|
||||||
cp.run(barrier::trans(db), args, std::cout);
|
plan.run(db, args, std::cout);
|
||||||
|
|
||||||
clock_t end = clock();
|
clock_t end = clock();
|
||||||
|
|
||||||
@ -63,7 +62,7 @@ int main(int argc, char **argv)
|
|||||||
sum += elapsed_ms;
|
sum += elapsed_ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "\nSearch for best " << barrier::limit
|
std::cout << "\nSearch for best " << limit
|
||||||
<< " results has runing time of:\n avg: " << sum / bench_n
|
<< " results has runing time of:\n avg: " << sum / bench_n
|
||||||
<< " [ms]\n";
|
<< " [ms]\n";
|
||||||
} while (true);
|
} while (true);
|
||||||
|
@ -4,9 +4,6 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
// TODO: remove barrier
|
|
||||||
#include "barrier/barrier.cpp"
|
|
||||||
|
|
||||||
#include "database/db.hpp"
|
#include "database/db.hpp"
|
||||||
#include "database/db_accessor.hpp"
|
#include "database/db_accessor.hpp"
|
||||||
#include "communication/bolt/v1/serialization/bolt_serializer.hpp"
|
#include "communication/bolt/v1/serialization/bolt_serializer.hpp"
|
||||||
@ -20,7 +17,7 @@ using namespace std;
|
|||||||
|
|
||||||
// (company, {type_name, score})
|
// (company, {type_name, score})
|
||||||
using company_profile_type =
|
using company_profile_type =
|
||||||
pair<barrier::VertexAccessor, unordered_map<string, double>>;
|
pair<VertexAccessor, unordered_map<string, double>>;
|
||||||
|
|
||||||
// Accepted flags for CSV import.
|
// Accepted flags for CSV import.
|
||||||
// -db name # will create database with that name.
|
// -db name # will create database with that name.
|
||||||
@ -44,7 +41,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
// query benchmark
|
// query benchmark
|
||||||
auto begin = clock();
|
auto begin = clock();
|
||||||
int n = for_all_companys(barrier::trans(t), company_profiles);
|
int n = for_all_companys(t, company_profiles);
|
||||||
clock_t end = clock();
|
clock_t end = clock();
|
||||||
double elapsed_s = (double(end - begin) / CLOCKS_PER_SEC);
|
double elapsed_s = (double(end - begin) / CLOCKS_PER_SEC);
|
||||||
|
|
||||||
@ -71,8 +68,8 @@ int main(int argc, char **argv)
|
|||||||
for (auto &company_profile : company_profiles) {
|
for (auto &company_profile : company_profiles) {
|
||||||
auto prop_vertex_id = t.vertex_property_key<Int64>("company_id");
|
auto prop_vertex_id = t.vertex_property_key<Int64>("company_id");
|
||||||
auto db_company_id =
|
auto db_company_id =
|
||||||
*barrier::trans(company_profile.first).at(prop_vertex_id).get();
|
company_profile.first.at(prop_vertex_id).get();
|
||||||
if (db_company_id == company_id) {
|
if (db_company_id->value() == company_id) {
|
||||||
cout << endl << "CompanyID: " << company_id << endl;
|
cout << endl << "CompanyID: " << company_id << endl;
|
||||||
for (auto e : company_profile.second) {
|
for (auto e : company_profile.second) {
|
||||||
cout << e.first << " = " << e.second << endl;
|
cout << e.first << " = " << e.second << endl;
|
||||||
|
@ -8,13 +8,10 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#include "barrier/barrier.hpp"
|
#include "storage/edge_x_vertex.hpp"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace barrier
|
|
||||||
{
|
|
||||||
|
|
||||||
// TODO: Turn next template, expand on it, standardize it, and use it for query
|
// TODO: Turn next template, expand on it, standardize it, and use it for query
|
||||||
// generation.
|
// generation.
|
||||||
|
|
||||||
@ -334,10 +331,9 @@ size_t for_all_companys(
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
iter::for_all_fill(
|
iter::for_all_fill(
|
||||||
t.label_find_or_create("Company").index().for_range(t), [&](auto v) {
|
t.label_find_or_create("Company").index().for_range(t), [&](auto v) {
|
||||||
coll.push_back(make_pair(v, barrier::query(t, v.id())));
|
coll.push_back(make_pair(v, query(t, v.id())));
|
||||||
i++;
|
i++;
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -3,8 +3,10 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "query/i_code_cpu.hpp"
|
#include "query/i_plan_cpu.hpp"
|
||||||
#include "storage/model/properties/all.hpp"
|
#include "storage/model/properties/all.hpp"
|
||||||
|
#include "storage/vertex_accessor.hpp"
|
||||||
|
#include "storage/edge_x_vertex.hpp"
|
||||||
#include "utils/memory/stack_allocator.hpp"
|
#include "utils/memory/stack_allocator.hpp"
|
||||||
|
|
||||||
using std::cout;
|
using std::cout;
|
||||||
@ -12,15 +14,10 @@ using std::endl;
|
|||||||
|
|
||||||
// Dressipi astar query of 4 clicks.
|
// Dressipi astar query of 4 clicks.
|
||||||
|
|
||||||
// BARRIER!
|
using Stream = std::ostream;
|
||||||
namespace barrier
|
|
||||||
{
|
|
||||||
|
|
||||||
using STREAM = std::ostream;
|
|
||||||
// using STREAM = RecordStream<::io::Socket>;
|
|
||||||
|
|
||||||
constexpr size_t max_depth = 3;
|
constexpr size_t max_depth = 3;
|
||||||
constexpr size_t limit = 10;
|
constexpr size_t limit = 10;
|
||||||
|
|
||||||
class Node
|
class Node
|
||||||
{
|
{
|
||||||
@ -45,9 +42,10 @@ public:
|
|||||||
|
|
||||||
double sum_vertex_score()
|
double sum_vertex_score()
|
||||||
{
|
{
|
||||||
auto now = this;
|
auto now = this;
|
||||||
double sum = 0;
|
double sum = 0;
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
sum += (now->vacc.at(tkey).get())->value();
|
sum += (now->vacc.at(tkey).get())->value();
|
||||||
now = now->parent;
|
now = now->parent;
|
||||||
} while (now != nullptr);
|
} while (now != nullptr);
|
||||||
@ -57,12 +55,15 @@ public:
|
|||||||
|
|
||||||
bool vertex_filter_contained(DbAccessor &t, VertexAccessor &v, Node *before)
|
bool vertex_filter_contained(DbAccessor &t, VertexAccessor &v, Node *before)
|
||||||
{
|
{
|
||||||
if (v.fill()) {
|
if (v.fill())
|
||||||
|
{
|
||||||
bool found;
|
bool found;
|
||||||
do {
|
do
|
||||||
found = false;
|
{
|
||||||
|
found = false;
|
||||||
before = before->parent;
|
before = before->parent;
|
||||||
if (before == nullptr) {
|
if (before == nullptr)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} while (v.in_contains(before->vacc));
|
} while (v.in_contains(before->vacc));
|
||||||
@ -70,7 +71,7 @@ bool vertex_filter_contained(DbAccessor &t, VertexAccessor &v, Node *before)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void astar(DbAccessor &t, code_args_t &args, STREAM &stream)
|
void astar(DbAccessor &t, plan_args_t &args, Stream &stream)
|
||||||
{
|
{
|
||||||
StackAllocator stack;
|
StackAllocator stack;
|
||||||
VertexPropertyType<Double> tkey = t.vertex_property_key<Double>("score");
|
VertexPropertyType<Double> tkey = t.vertex_property_key<Double>("score");
|
||||||
@ -79,7 +80,8 @@ void astar(DbAccessor &t, code_args_t &args, STREAM &stream)
|
|||||||
std::priority_queue<Node *, std::vector<Node *>, decltype(cmp)> queue(cmp);
|
std::priority_queue<Node *, std::vector<Node *>, decltype(cmp)> queue(cmp);
|
||||||
|
|
||||||
auto start_vr = t.vertex_find(Id(args[0].as<Int64>().value()));
|
auto start_vr = t.vertex_find(Id(args[0].as<Int64>().value()));
|
||||||
if (!start_vr.is_present()) {
|
if (!start_vr.is_present())
|
||||||
|
{
|
||||||
// stream.write_failure({{}});
|
// stream.write_failure({{}});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -89,15 +91,18 @@ void astar(DbAccessor &t, code_args_t &args, STREAM &stream)
|
|||||||
queue.push(start);
|
queue.push(start);
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
auto now = queue.top();
|
auto now = queue.top();
|
||||||
queue.pop();
|
queue.pop();
|
||||||
|
|
||||||
if (max_depth <= now->depth) {
|
if (max_depth <= now->depth)
|
||||||
|
{
|
||||||
// stream.write_success_empty();
|
// stream.write_success_empty();
|
||||||
// best.push_back(now);
|
// best.push_back(now);
|
||||||
count++;
|
count++;
|
||||||
if (count >= limit) {
|
if (count >= limit)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -105,9 +110,10 @@ void astar(DbAccessor &t, code_args_t &args, STREAM &stream)
|
|||||||
|
|
||||||
iter::for_all(now->vacc.out(), [&](auto edge) {
|
iter::for_all(now->vacc.out(), [&](auto edge) {
|
||||||
VertexAccessor va = edge.to();
|
VertexAccessor va = edge.to();
|
||||||
if (vertex_filter_contained(t, va, now)) {
|
if (vertex_filter_contained(t, va, now))
|
||||||
|
{
|
||||||
auto cost = 1 - va.at(tkey).get()->value();
|
auto cost = 1 - va.at(tkey).get()->value();
|
||||||
Node *n = new (stack.allocate<Node>())
|
Node *n = new (stack.allocate<Node>())
|
||||||
Node(va, now->cost + cost, now, tkey);
|
Node(va, now->cost + cost, now, tkey);
|
||||||
queue.push(n);
|
queue.push(n);
|
||||||
}
|
}
|
||||||
@ -117,10 +123,10 @@ void astar(DbAccessor &t, code_args_t &args, STREAM &stream)
|
|||||||
stack.free();
|
stack.free();
|
||||||
}
|
}
|
||||||
|
|
||||||
class CodeCPU : public ICodeCPU<STREAM>
|
class PlanCPU : public IPlanCPU<Stream>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool run(Db &db, code_args_t &args, STREAM &stream) override
|
bool run(Db &db, plan_args_t &args, Stream &stream) override
|
||||||
{
|
{
|
||||||
DbAccessor t(db);
|
DbAccessor t(db);
|
||||||
|
|
||||||
@ -129,14 +135,9 @@ public:
|
|||||||
return t.commit();
|
return t.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
~CodeCPU() {}
|
~PlanCPU() {}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" ICodeCPU<barrier::STREAM> *produce()
|
extern "C" IPlanCPU<Stream> *produce() { return new PlanCPU(); }
|
||||||
{
|
|
||||||
// BARRIER!
|
|
||||||
return new barrier::CodeCPU();
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void destruct(ICodeCPU<barrier::STREAM> *p) { delete p; }
|
extern "C" void destruct(IPlanCPU<Stream> *p) { delete p; }
|
@ -11,8 +11,6 @@
|
|||||||
#include "storage/edge_x_vertex.hpp"
|
#include "storage/edge_x_vertex.hpp"
|
||||||
#include "storage/indexes/impl/nonunique_unordered_index.cpp"
|
#include "storage/indexes/impl/nonunique_unordered_index.cpp"
|
||||||
#include "storage/model/properties/properties.cpp"
|
#include "storage/model/properties/properties.cpp"
|
||||||
// #include "storage/record_accessor.cpp"
|
|
||||||
// #include "storage/vertex_accessor.cpp"
|
|
||||||
#include "utils/command_line/arguments.hpp"
|
#include "utils/command_line/arguments.hpp"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -37,7 +37,10 @@ cp -r include ../release/${exe_name}/include
|
|||||||
cp -r template ../release/${exe_name}/template
|
cp -r template ../release/${exe_name}/template
|
||||||
cp -r ../config ../release/${exe_name}/config
|
cp -r ../config ../release/${exe_name}/config
|
||||||
|
|
||||||
mkdir -p ../release/${exe_name}/compiled/cpu
|
# create compiled folder and copy hard coded queries
|
||||||
|
mkdir -p ../release/${exe_name}/compiled/cpu/hardcode
|
||||||
|
cp ../tests/integration/hardcoded_query/*.cpp ../release/${exe_name}/compiled/cpu/hardcode
|
||||||
|
cp ../tests/integration/hardcoded_query/*.hpp ../release/${exe_name}/compiled/cpu/hardcode
|
||||||
|
|
||||||
echo "Memgraph Release Building DONE"
|
echo "Memgraph Release Building DONE"
|
||||||
|
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
FROM ubuntu:16.04
|
|
||||||
|
|
||||||
RUN apt-get update \
|
|
||||||
&& apt-get install -y clang libssl-dev \
|
|
||||||
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
||||||
|
|
||||||
RUN mkdir -p /libs
|
|
||||||
|
|
||||||
ENV BINARY_NAME memgraph_414_dba2610_dev_debug
|
|
||||||
|
|
||||||
COPY barrier_$BINARY_NAME /memgraph
|
|
||||||
COPY libs/fmt /libs/fmt
|
|
||||||
|
|
||||||
WORKDIR /memgraph
|
|
||||||
|
|
||||||
CMD ./$BINARY_NAME
|
|
@ -1,54 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
binary_name=$1
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
release_folder="barrier_$binary_name"
|
|
||||||
release_path="release/$release_folder"
|
|
||||||
compile_template_path="template/barrier_template_code_cpu.cpp"
|
|
||||||
|
|
||||||
mkdir -p $release_path/compiled/cpu
|
|
||||||
|
|
||||||
mkdir -p $release_path/include/barrier
|
|
||||||
mkdir -p $release_path/include/query/strip
|
|
||||||
mkdir -p $release_path/include/query/exception
|
|
||||||
mkdir -p $release_path/include/io/network
|
|
||||||
mkdir -p $release_path/include/logging
|
|
||||||
mkdir -p $release_path/include/mvcc
|
|
||||||
mkdir -p $release_path/include/storage/indexes
|
|
||||||
mkdir -p $release_path/include/storage/model/properties/traversers
|
|
||||||
mkdir -p $release_path/include/storage/model/properties/utils
|
|
||||||
mkdir -p $release_path/include/utils/datetime
|
|
||||||
mkdir -p $release_path/include/utils/exceptions
|
|
||||||
mkdir -p $release_path/include/utils/iterator
|
|
||||||
mkdir -p $release_path/include/utils/memory
|
|
||||||
mkdir -p $release_path/include/utils/numerics
|
|
||||||
|
|
||||||
mkdir -p $release_path/template
|
|
||||||
|
|
||||||
# COPY
|
|
||||||
# dressipi query
|
|
||||||
# TODO: for loop
|
|
||||||
# hardcoded_queries="135757557963690525.cpp"
|
|
||||||
# for query in $hardcoded_queries
|
|
||||||
# do
|
|
||||||
# cp build/compiled/cpu/hardcode/$query $release_path/compiled/cpu/hardcode/$query
|
|
||||||
# done
|
|
||||||
|
|
||||||
cp src/query_engine/$compile_template_path $release_path/$compile_template_path
|
|
||||||
|
|
||||||
paths="barrier/barrier.hpp barrier/common.hpp storage/model/properties/floating.hpp storage/model/properties/all.hpp storage/model/properties/bool.hpp storage/model/properties/traversers/consolewriter.hpp storage/model/properties/traversers/jsonwriter.hpp storage/model/properties/array.hpp storage/model/properties/property_family.hpp storage/model/properties/property.hpp storage/model/properties/properties.hpp storage/model/properties/integral.hpp storage/model/properties/double.hpp storage/model/properties/string.hpp storage/model/properties/utils/math_operations.hpp storage/model/properties/utils/unary_negation.hpp storage/model/properties/utils/modulo.hpp storage/model/properties/property_holder.hpp storage/model/properties/float.hpp storage/model/properties/null.hpp storage/model/properties/flags.hpp storage/model/properties/int32.hpp storage/model/properties/number.hpp storage/model/properties/int64.hpp logging/default.hpp logging/log.hpp logging/logger.hpp logging/levels.hpp io/network/addrinfo.hpp io/network/network_error.hpp io/network/socket.hpp mvcc/id.hpp utils/exceptions/basic_exception.hpp utils/border.hpp utils/total_ordering.hpp utils/auto_scope.hpp utils/crtp.hpp utils/order.hpp utils/likely.hpp utils/option.hpp utils/option_ptr.hpp utils/memory/block_allocator.hpp utils/memory/stack_allocator.hpp utils/iterator/query.hpp utils/iterator/composable.hpp utils/iterator/for_all.hpp utils/iterator/range_iterator.hpp utils/iterator/limited_map.hpp utils/iterator/iterator_accessor.hpp utils/iterator/count.hpp utils/iterator/iterator_base.hpp utils/iterator/filter.hpp utils/iterator/inspect.hpp utils/iterator/accessor.hpp utils/iterator/map.hpp utils/iterator/virtual_iter.hpp utils/iterator/flat_map.hpp utils/iterator/combined.hpp utils/iterator/lambda_iterator.hpp utils/iterator/iterator.hpp utils/array_store.hpp utils/void.hpp storage/indexes/index_definition.hpp utils/stacktrace.hpp utils/datetime/datetime_error.hpp utils/datetime/timestamp.hpp utils/reference_wrapper.hpp utils/underlying_cast.hpp utils/numerics/saturate.hpp query/i_plan_cpu.hpp query/property_util.hpp query/strip/stripped.hpp query/exception/cpp_code_generator.hpp query/exception/decoder_exception.hpp query/exception/out_of_memory.hpp query/exception/plan_compilation.hpp query/exception/plan_execution.hpp query/exception/query_engine.hpp"
|
|
||||||
|
|
||||||
for path in $paths
|
|
||||||
do
|
|
||||||
cp include/$path $release_path/include/$path
|
|
||||||
done
|
|
||||||
|
|
||||||
cp config/memgraph.yaml $release_path/config.yaml
|
|
||||||
|
|
||||||
cp build/$binary_name $release_path/$binary_name
|
|
||||||
cp build/libmemgraph_pic.a $release_path/libmemgraph_pic.a
|
|
||||||
cp build/libbarrier_pic.a $release_path/libbarrier_pic.a
|
|
||||||
|
|
||||||
echo "DONE"
|
|
@ -1,766 +0,0 @@
|
|||||||
#include "barrier/trans.hpp"
|
|
||||||
|
|
||||||
// ************************* Implementations
|
|
||||||
// This file should contain all implementations of methods from barrier classes
|
|
||||||
// defined in barrier.hpp.
|
|
||||||
// Implementations should follow the form:
|
|
||||||
// border_return_type border_class::method_name(arguments){
|
|
||||||
// return
|
|
||||||
// CALL(method_name(trans(arguments)))
|
|
||||||
// or
|
|
||||||
// HALF_CALL(method_name(trans(arguments)));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// **************************** HELPER DEFINES *******************************//
|
|
||||||
// returns transformed this pointer
|
|
||||||
#define THIS (trans(this))
|
|
||||||
// In border class performs call x on original class.
|
|
||||||
#define HALF_CALL(x) (THIS->x)
|
|
||||||
// In border class performs call x on original class and produces transformed
|
|
||||||
// output.
|
|
||||||
#define CALL(x) trans(HALF_CALL(x))
|
|
||||||
|
|
||||||
// Creates destructor for border type x which is original type y.
|
|
||||||
#define DESTRUCTOR(x, y) \
|
|
||||||
x::~x() { HALF_CALL(~y()); }
|
|
||||||
|
|
||||||
// Creates copy constructor for mutable ref to border class x which is original
|
|
||||||
// class y.
|
|
||||||
#define COPY_CONSTRUCTOR_MUT(x, y) \
|
|
||||||
x::x(x &other) : Sized(y(trans(other))) {}
|
|
||||||
|
|
||||||
// Creates copy constructor for const ref to border class x which is original
|
|
||||||
// class y.
|
|
||||||
#define COPY_CONSTRUCTOR(x, y) \
|
|
||||||
x::x(const x &other) : Sized(y(trans(other))) {}
|
|
||||||
|
|
||||||
// Creates move constructor for mutable border type x.
|
|
||||||
#define MOVE_CONSTRUCTOR(x) \
|
|
||||||
x::x(x &&other) : Sized(trans(std::move(other))) {}
|
|
||||||
|
|
||||||
// Creates move constructor for const border type x.
|
|
||||||
#define MOVE_CONST_CONSTRUCTOR(x) \
|
|
||||||
x::x(x const &&other) : Sized(trans(std::move(other))) {}
|
|
||||||
|
|
||||||
// Creates copy operator for border type x.
|
|
||||||
#define COPY_OPERATOR(x) \
|
|
||||||
x &x::operator=(const x &other) \
|
|
||||||
{ \
|
|
||||||
HALF_CALL(operator=(trans(other))); \
|
|
||||||
return *this; \
|
|
||||||
}
|
|
||||||
|
|
||||||
// Creates move operator for border type x.
|
|
||||||
#define MOVE_OPERATOR(x) \
|
|
||||||
x &x::operator=(x &&other) \
|
|
||||||
{ \
|
|
||||||
HALF_CALL(operator=(trans(std::move(other)))); \
|
|
||||||
return *this; \
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace barrier
|
|
||||||
{
|
|
||||||
|
|
||||||
// ***************** Label
|
|
||||||
VertexIndex<std::nullptr_t> &Label::index() const { return CALL(index()); }
|
|
||||||
|
|
||||||
// **************** EdgeType
|
|
||||||
bool operator<(const EdgeType &lhs, const EdgeType &rhs)
|
|
||||||
{
|
|
||||||
return trans(lhs) < trans(rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const EdgeType &lhs, const EdgeType &rhs)
|
|
||||||
{
|
|
||||||
return trans(lhs) == trans(rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
EdgeIndex<std::nullptr_t> &EdgeType::index() const { return CALL(index()); }
|
|
||||||
|
|
||||||
// **************** VertexIndex
|
|
||||||
template <class K>
|
|
||||||
VertexIterator VertexIndex<K>::for_range(DbAccessor &t, Border<K> from,
|
|
||||||
Border<K> to)
|
|
||||||
{
|
|
||||||
return CALL(for_range(trans(t), std::move(from), std::move(to)));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class K>
|
|
||||||
IndexType VertexIndex<K>::type()
|
|
||||||
{
|
|
||||||
return HALF_CALL(type());
|
|
||||||
}
|
|
||||||
|
|
||||||
// INSTANCES OF VERTEX INDEX
|
|
||||||
template class VertexIndex<std::nullptr_t>;
|
|
||||||
|
|
||||||
// **************** EdgeIndex
|
|
||||||
template <class K>
|
|
||||||
EdgeIterator EdgeIndex<K>::for_range(DbAccessor &t, Border<K> from,
|
|
||||||
Border<K> to)
|
|
||||||
{
|
|
||||||
return CALL(for_range(trans(t), std::move(from), std::move(to)));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class K>
|
|
||||||
IndexType EdgeIndex<K>::type()
|
|
||||||
{
|
|
||||||
return HALF_CALL(type());
|
|
||||||
}
|
|
||||||
|
|
||||||
// INSTANCES OF EDGE INDEX
|
|
||||||
template class EdgeIndex<std::nullptr_t>;
|
|
||||||
|
|
||||||
// ************************* DbAccessor
|
|
||||||
DESTRUCTOR(DbAccessor, DbAccessor);
|
|
||||||
|
|
||||||
VertexAccessIterator DbAccessor::vertex_access()
|
|
||||||
{
|
|
||||||
return CALL(vertex_access());
|
|
||||||
}
|
|
||||||
|
|
||||||
Option<const VertexAccessor> DbAccessor::vertex_find(const Id &id)
|
|
||||||
{
|
|
||||||
return HALF_CALL(vertex_find(id)).map<const VertexAccessor>();
|
|
||||||
}
|
|
||||||
|
|
||||||
VertexAccessor DbAccessor::vertex_insert() { return CALL(vertex_insert()); }
|
|
||||||
|
|
||||||
EdgeAccessIterator DbAccessor::edge_access() { return CALL(edge_access()); }
|
|
||||||
|
|
||||||
Option<const EdgeAccessor> DbAccessor::edge_find(const Id &id)
|
|
||||||
{
|
|
||||||
return HALF_CALL(edge_find(id)).map<const EdgeAccessor>();
|
|
||||||
}
|
|
||||||
|
|
||||||
EdgeAccessor DbAccessor::edge_insert(VertexAccessor const &from,
|
|
||||||
VertexAccessor const &to)
|
|
||||||
{
|
|
||||||
return CALL(edge_insert(trans(from), trans(to)));
|
|
||||||
}
|
|
||||||
|
|
||||||
const Label &DbAccessor::label_find_or_create(const char *name)
|
|
||||||
{
|
|
||||||
return CALL(label_find_or_create(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DbAccessor::label_contains(const char *name)
|
|
||||||
{
|
|
||||||
return HALF_CALL(label_contains(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
const EdgeType &DbAccessor::type_find_or_create(const char *name)
|
|
||||||
{
|
|
||||||
return CALL(type_find_or_create(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DbAccessor::type_contains(const char *name)
|
|
||||||
{
|
|
||||||
return HALF_CALL(type_contains(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
VertexPropertyFamily &
|
|
||||||
DbAccessor::vertex_property_family_get(const std::string &name)
|
|
||||||
{
|
|
||||||
return CALL(vertex_property_family_get(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
EdgePropertyFamily &
|
|
||||||
DbAccessor::edge_property_family_get(const std::string &name)
|
|
||||||
{
|
|
||||||
return CALL(edge_property_family_get(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
VertexPropertyKey DbAccessor::vertex_property_key(const std::string &name,
|
|
||||||
Type type)
|
|
||||||
{
|
|
||||||
return CALL(vertex_property_key(name, type));
|
|
||||||
}
|
|
||||||
|
|
||||||
EdgePropertyKey DbAccessor::edge_property_key(const std::string &name,
|
|
||||||
Type type)
|
|
||||||
{
|
|
||||||
return CALL(edge_property_key(name, type));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
VertexPropertyType<T> DbAccessor::vertex_property_key(const std::string &name)
|
|
||||||
{
|
|
||||||
return CALL(vertex_property_key<T>(name));
|
|
||||||
}
|
|
||||||
#define DbAccessor_vertex_property_key(x) \
|
|
||||||
template VertexPropertyType<x> DbAccessor::vertex_property_key<x>( \
|
|
||||||
const std::string &name);
|
|
||||||
INSTANTIATE_FOR_PROPERTY(DbAccessor_vertex_property_key)
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
EdgePropertyType<T> DbAccessor::edge_property_key(const std::string &name)
|
|
||||||
{
|
|
||||||
return CALL(edge_property_key<T>(name));
|
|
||||||
}
|
|
||||||
#define DbAccessor_edge_property_key(x) \
|
|
||||||
template EdgePropertyType<x> DbAccessor::edge_property_key<x>( \
|
|
||||||
const std::string &name);
|
|
||||||
INSTANTIATE_FOR_PROPERTY(DbAccessor_edge_property_key)
|
|
||||||
|
|
||||||
bool DbAccessor::commit() { return HALF_CALL(commit()); }
|
|
||||||
void DbAccessor::abort() { HALF_CALL(abort()); }
|
|
||||||
|
|
||||||
// ************************** VertexAccessor
|
|
||||||
DUP(VertexAccessor, COPY_CONSTRUCTOR);
|
|
||||||
DUP(VertexAccessor, COPY_CONSTRUCTOR_MUT);
|
|
||||||
MOVE_CONSTRUCTOR(VertexAccessor);
|
|
||||||
MOVE_CONST_CONSTRUCTOR(VertexAccessor);
|
|
||||||
DESTRUCTOR(VertexAccessor, VertexAccessor);
|
|
||||||
COPY_OPERATOR(VertexAccessor);
|
|
||||||
MOVE_OPERATOR(VertexAccessor);
|
|
||||||
|
|
||||||
bool VertexAccessor::isolated() const { return HALF_CALL(isolated()); }
|
|
||||||
|
|
||||||
size_t VertexAccessor::out_degree() const { return HALF_CALL(out_degree()); }
|
|
||||||
|
|
||||||
size_t VertexAccessor::in_degree() const { return HALF_CALL(in_degree()); }
|
|
||||||
|
|
||||||
size_t VertexAccessor::degree() const { return HALF_CALL(degree()); }
|
|
||||||
|
|
||||||
bool VertexAccessor::add_label(const Label &label)
|
|
||||||
{
|
|
||||||
return HALF_CALL(add_label(trans(label)));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool VertexAccessor::remove_label(const Label &label)
|
|
||||||
{
|
|
||||||
return HALF_CALL(remove_label(trans(label)));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool VertexAccessor::has_label(const Label &label) const
|
|
||||||
{
|
|
||||||
return HALF_CALL(has_label(trans(label)));
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::vector<label_ref_t> &VertexAccessor::labels() const
|
|
||||||
{
|
|
||||||
return CALL(labels());
|
|
||||||
}
|
|
||||||
|
|
||||||
OutEdgesIterator VertexAccessor::out() const { return CALL(out()); }
|
|
||||||
|
|
||||||
InEdgesIterator VertexAccessor::in() const { return CALL(in()); }
|
|
||||||
|
|
||||||
bool VertexAccessor::in_contains(VertexAccessor const &other) const
|
|
||||||
{
|
|
||||||
return HALF_CALL(in_contains(trans(other)));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool VertexAccessor::empty() const { return HALF_CALL(empty()); }
|
|
||||||
|
|
||||||
bool VertexAccessor::fill() const { return HALF_CALL(fill()); }
|
|
||||||
|
|
||||||
const Id &VertexAccessor::id() const { return HALF_CALL(id()); }
|
|
||||||
|
|
||||||
VertexAccessor VertexAccessor::update() const { return CALL(update()); }
|
|
||||||
|
|
||||||
void VertexAccessor::remove() const { HALF_CALL(remove()); }
|
|
||||||
|
|
||||||
const VertexStoredProperty &VertexAccessor::at(VertexPropertyFamily &key) const
|
|
||||||
{
|
|
||||||
return CALL(at(trans(key)));
|
|
||||||
}
|
|
||||||
|
|
||||||
const VertexStoredProperty &VertexAccessor::at(VertexPropertyKey &key) const
|
|
||||||
{
|
|
||||||
return CALL(at(trans(key)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// template <class TG>
|
|
||||||
// bool VertexAccessor::contains(property_key<TG> &key) const
|
|
||||||
// {
|
|
||||||
// return HALF_CALL(contains<TG>(key));
|
|
||||||
// }
|
|
||||||
|
|
||||||
template <class V>
|
|
||||||
OptionPtr<const V> VertexAccessor::at(VertexPropertyType<V> &key) const
|
|
||||||
{
|
|
||||||
return HALF_CALL(at(trans<V>(key)));
|
|
||||||
}
|
|
||||||
#define VertexAccessor_at(x) \
|
|
||||||
template OptionPtr<const x> VertexAccessor::at(VertexPropertyType<x> &key) \
|
|
||||||
const;
|
|
||||||
INSTANTIATE_FOR_PROPERTY(VertexAccessor_at);
|
|
||||||
|
|
||||||
void VertexAccessor::set(VertexPropertyKey &key, Property &&value)
|
|
||||||
{
|
|
||||||
HALF_CALL(set(trans(key), std::move(value)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void VertexAccessor::clear(VertexPropertyKey &key)
|
|
||||||
{
|
|
||||||
HALF_CALL(clear(trans(key)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void VertexAccessor::clear(VertexPropertyFamily &key)
|
|
||||||
{
|
|
||||||
HALF_CALL(clear(trans(key)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: I am not quite sure if this method will have any use
|
|
||||||
template <class Handler>
|
|
||||||
void VertexAccessor::accept(Handler &handler) const
|
|
||||||
{
|
|
||||||
HALF_CALL(accept(handler));
|
|
||||||
}
|
|
||||||
|
|
||||||
VertexAccessor::operator bool() const { return HALF_CALL(operator bool()); }
|
|
||||||
|
|
||||||
bool operator==(const VertexAccessor &a, const VertexAccessor &b)
|
|
||||||
{
|
|
||||||
return trans(a) == trans(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const VertexAccessor &a, const VertexAccessor &b)
|
|
||||||
{
|
|
||||||
return trans(a) != trans(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************** EdgeAccessor
|
|
||||||
DUP(EdgeAccessor, COPY_CONSTRUCTOR);
|
|
||||||
DUP(EdgeAccessor, COPY_CONSTRUCTOR_MUT);
|
|
||||||
MOVE_CONSTRUCTOR(EdgeAccessor);
|
|
||||||
MOVE_CONST_CONSTRUCTOR(EdgeAccessor);
|
|
||||||
DESTRUCTOR(EdgeAccessor, EdgeAccessor);
|
|
||||||
COPY_OPERATOR(EdgeAccessor);
|
|
||||||
MOVE_OPERATOR(EdgeAccessor);
|
|
||||||
|
|
||||||
void EdgeAccessor::edge_type(const EdgeType &edge_type)
|
|
||||||
{
|
|
||||||
HALF_CALL(edge_type(trans(edge_type)));
|
|
||||||
}
|
|
||||||
|
|
||||||
const EdgeType &EdgeAccessor::edge_type() const { return CALL(edge_type()); }
|
|
||||||
|
|
||||||
const VertexAccessor EdgeAccessor::from() const { return CALL(from()); }
|
|
||||||
|
|
||||||
const VertexAccessor EdgeAccessor::to() const { return CALL(to()); }
|
|
||||||
|
|
||||||
bool EdgeAccessor::empty() const { return HALF_CALL(empty()); }
|
|
||||||
|
|
||||||
bool EdgeAccessor::fill() const { return HALF_CALL(fill()); }
|
|
||||||
|
|
||||||
const Id &EdgeAccessor::id() const { return HALF_CALL(id()); }
|
|
||||||
|
|
||||||
EdgeAccessor EdgeAccessor::update() const { return CALL(update()); }
|
|
||||||
|
|
||||||
void EdgeAccessor::remove() const { HALF_CALL(remove()); }
|
|
||||||
|
|
||||||
const EdgeStoredProperty &EdgeAccessor::at(EdgePropertyFamily &key) const
|
|
||||||
{
|
|
||||||
return CALL(at(trans(key)));
|
|
||||||
}
|
|
||||||
|
|
||||||
const EdgeStoredProperty &EdgeAccessor::at(EdgePropertyKey &key) const
|
|
||||||
{
|
|
||||||
return CALL(at(trans(key)));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class V>
|
|
||||||
OptionPtr<const V> EdgeAccessor::at(EdgePropertyType<V> &key) const
|
|
||||||
{
|
|
||||||
return HALF_CALL(at(trans<V>(key)));
|
|
||||||
}
|
|
||||||
#define EdgeAccessor_at(x) \
|
|
||||||
template OptionPtr<const x> EdgeAccessor::at(EdgePropertyType<x> &key) \
|
|
||||||
const;
|
|
||||||
INSTANTIATE_FOR_PROPERTY(EdgeAccessor_at);
|
|
||||||
|
|
||||||
void EdgeAccessor::set(EdgePropertyKey &key, Property &&value)
|
|
||||||
{
|
|
||||||
HALF_CALL(set(trans(key), std::move(value)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void EdgeAccessor::clear(EdgePropertyKey &key) { HALF_CALL(clear(trans(key))); }
|
|
||||||
|
|
||||||
void EdgeAccessor::clear(EdgePropertyFamily &key)
|
|
||||||
{
|
|
||||||
HALF_CALL(clear(trans(key)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: I am not quite sure if this method will have any use
|
|
||||||
template <class Handler>
|
|
||||||
void EdgeAccessor::accept(Handler &handler) const
|
|
||||||
{
|
|
||||||
HALF_CALL(accept(handler));
|
|
||||||
}
|
|
||||||
|
|
||||||
EdgeAccessor::operator bool() const { return HALF_CALL(operator bool()); }
|
|
||||||
|
|
||||||
bool operator==(const EdgeAccessor &a, const EdgeAccessor &b)
|
|
||||||
{
|
|
||||||
return trans(a) == trans(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const EdgeAccessor &a, const EdgeAccessor &b)
|
|
||||||
{
|
|
||||||
return trans(a) != trans(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************* VertexIterator
|
|
||||||
DESTRUCTOR(VertexIterator, Virtual);
|
|
||||||
|
|
||||||
Option<const VertexAccessor> VertexIterator::next()
|
|
||||||
{
|
|
||||||
return HALF_CALL(next()).map<const VertexAccessor>();
|
|
||||||
}
|
|
||||||
|
|
||||||
Count VertexIterator::count() { return HALF_CALL(count()); }
|
|
||||||
|
|
||||||
// ************************* EdgeIterator
|
|
||||||
DESTRUCTOR(EdgeIterator, Virtual);
|
|
||||||
|
|
||||||
Option<const EdgeAccessor> EdgeIterator::next()
|
|
||||||
{
|
|
||||||
return HALF_CALL(next()).map<const EdgeAccessor>();
|
|
||||||
}
|
|
||||||
|
|
||||||
Count EdgeIterator::count() { return HALF_CALL(count()); }
|
|
||||||
|
|
||||||
// ************************* OutEdgesIterator
|
|
||||||
DESTRUCTOR(OutEdgesIterator, out_edge_iterator_t);
|
|
||||||
|
|
||||||
Option<const EdgeAccessor> OutEdgesIterator::next()
|
|
||||||
{
|
|
||||||
return HALF_CALL(next()).map<const EdgeAccessor>();
|
|
||||||
}
|
|
||||||
|
|
||||||
Count OutEdgesIterator::count() { return HALF_CALL(count()); }
|
|
||||||
|
|
||||||
// ************************* InEdgesIterator
|
|
||||||
DESTRUCTOR(InEdgesIterator, in_edge_iterator_t);
|
|
||||||
|
|
||||||
Option<const EdgeAccessor> InEdgesIterator::next()
|
|
||||||
{
|
|
||||||
return HALF_CALL(next()).map<const EdgeAccessor>();
|
|
||||||
}
|
|
||||||
|
|
||||||
Count InEdgesIterator::count() { return HALF_CALL(count()); }
|
|
||||||
|
|
||||||
// ************************* VertexAccessIterator
|
|
||||||
DESTRUCTOR(VertexAccessIterator, vertex_access_iterator_t);
|
|
||||||
|
|
||||||
Option<const VertexAccessor> VertexAccessIterator::next()
|
|
||||||
{
|
|
||||||
return HALF_CALL(next()).map<const VertexAccessor>();
|
|
||||||
}
|
|
||||||
|
|
||||||
Count VertexAccessIterator::count() { return HALF_CALL(count()); }
|
|
||||||
|
|
||||||
// ************************* EdgeAccessIterator
|
|
||||||
DESTRUCTOR(EdgeAccessIterator, edge_access_iterator_t);
|
|
||||||
|
|
||||||
Option<const EdgeAccessor> EdgeAccessIterator::next()
|
|
||||||
{
|
|
||||||
return HALF_CALL(next()).map<const EdgeAccessor>();
|
|
||||||
}
|
|
||||||
|
|
||||||
Count EdgeAccessIterator::count() { return HALF_CALL(count()); }
|
|
||||||
|
|
||||||
// ************************* VertexPropertyKey
|
|
||||||
DESTRUCTOR(VertexPropertyKey, PropertyFamilyKey);
|
|
||||||
|
|
||||||
Type VertexPropertyKey::get_type() const { return HALF_CALL(get_type()); }
|
|
||||||
|
|
||||||
// ************************* EdgePropertyKey
|
|
||||||
DESTRUCTOR(EdgePropertyKey, PropertyFamilyKey);
|
|
||||||
|
|
||||||
Type EdgePropertyKey::get_type() const { return HALF_CALL(get_type()); }
|
|
||||||
|
|
||||||
// ************************* VertexPropertyType
|
|
||||||
#define VERTEX_PROPERTY_TYPE(x) template class VertexPropertyType<x>;
|
|
||||||
INSTANTIATE_FOR_PROPERTY(VERTEX_PROPERTY_TYPE)
|
|
||||||
|
|
||||||
// ************************* VertexPropertyFamily
|
|
||||||
OptionPtr<VertexIndex<std::nullptr_t>> VertexPropertyFamily::index()
|
|
||||||
{
|
|
||||||
OptionPtr<IndexBase<TypeGroupVertex, std::nullptr_t>> ret =
|
|
||||||
THIS->index.get_read();
|
|
||||||
if (ret.is_present()) {
|
|
||||||
return OptionPtr<VertexIndex<std::nullptr_t>>(&trans(*ret.get()));
|
|
||||||
} else {
|
|
||||||
return OptionPtr<VertexIndex<std::nullptr_t>>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************* VertexPropertyFamily
|
|
||||||
OptionPtr<EdgeIndex<std::nullptr_t>> EdgePropertyFamily::index()
|
|
||||||
{
|
|
||||||
OptionPtr<IndexBase<TypeGroupEdge, std::nullptr_t>> ret =
|
|
||||||
THIS->index.get_read();
|
|
||||||
if (ret.is_present()) {
|
|
||||||
return OptionPtr<EdgeIndex<std::nullptr_t>>(&trans(*ret.get()));
|
|
||||||
} else {
|
|
||||||
return OptionPtr<EdgeIndex<std::nullptr_t>>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************* BOLT SERIALIZER
|
|
||||||
template <class Stream>
|
|
||||||
RecordStream<Stream>::~RecordStream()
|
|
||||||
{
|
|
||||||
// TODO: solve this
|
|
||||||
// THIS->~RecordStream();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write(const VertexAccessor &vertex)
|
|
||||||
{
|
|
||||||
HALF_CALL(write(trans(vertex)));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write(const EdgeAccessor &edge)
|
|
||||||
{
|
|
||||||
HALF_CALL(write(trans(edge)));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write(const VertexStoredProperty &prop)
|
|
||||||
{
|
|
||||||
HALF_CALL(write(trans(prop)));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write(const EdgeStoredProperty &prop)
|
|
||||||
{
|
|
||||||
HALF_CALL(write(trans(prop)));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write(const Null &v)
|
|
||||||
{
|
|
||||||
HALF_CALL(write(v));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write(const Bool &prop)
|
|
||||||
{
|
|
||||||
HALF_CALL(write(prop));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write(const Float &prop)
|
|
||||||
{
|
|
||||||
HALF_CALL(write(prop));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write(const Double &prop)
|
|
||||||
{
|
|
||||||
HALF_CALL(write(prop));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write(const Int32 &prop)
|
|
||||||
{
|
|
||||||
HALF_CALL(write(prop));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write(const Int64 &prop)
|
|
||||||
{
|
|
||||||
HALF_CALL(write(prop));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write(const String &value)
|
|
||||||
{
|
|
||||||
HALF_CALL(write(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write(const ArrayBool &arr)
|
|
||||||
{
|
|
||||||
HALF_CALL(write(arr));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write(const ArrayInt32 &arr)
|
|
||||||
{
|
|
||||||
HALF_CALL(write(arr));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write(const ArrayInt64 &arr)
|
|
||||||
{
|
|
||||||
HALF_CALL(write(arr));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write(const ArrayFloat &arr)
|
|
||||||
{
|
|
||||||
HALF_CALL(write(arr));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write(const ArrayDouble &arr)
|
|
||||||
{
|
|
||||||
HALF_CALL(write(arr));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write(const ArrayString &arr)
|
|
||||||
{
|
|
||||||
HALF_CALL(write(arr));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write_empty_fields()
|
|
||||||
{
|
|
||||||
HALF_CALL(write_empty_fields());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write_success()
|
|
||||||
{
|
|
||||||
HALF_CALL(write_success());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write_success_empty()
|
|
||||||
{
|
|
||||||
HALF_CALL(write_success_empty());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write_ignored()
|
|
||||||
{
|
|
||||||
HALF_CALL(write_ignored());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write_fields(const std::vector<std::string> &fields)
|
|
||||||
{
|
|
||||||
HALF_CALL(write_fields(fields));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write_field(const std::string &field)
|
|
||||||
{
|
|
||||||
HALF_CALL(write_field(field));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write_list_header(size_t size)
|
|
||||||
{
|
|
||||||
HALF_CALL(write_list_header(size));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write_record()
|
|
||||||
{
|
|
||||||
HALF_CALL(write_record());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write_meta(const std::string &type)
|
|
||||||
{
|
|
||||||
HALF_CALL(write_meta(type));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::write_failure(
|
|
||||||
const std::map<std::string, std::string> &data)
|
|
||||||
{
|
|
||||||
HALF_CALL(write_failure(data));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::send()
|
|
||||||
{
|
|
||||||
HALF_CALL(send());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Stream>
|
|
||||||
void RecordStream<Stream>::chunk()
|
|
||||||
{
|
|
||||||
HALF_CALL(chunk());
|
|
||||||
}
|
|
||||||
|
|
||||||
template class RecordStream<io::Socket>;
|
|
||||||
}
|
|
||||||
|
|
||||||
// **************************** ERROR EXAMPLES ****************************** //
|
|
||||||
// **************************** COMPILE TIME
|
|
||||||
/*
|
|
||||||
### error:
|
|
||||||
../libmemgraph.a(barrier.cpp.o): In function `Option<barrier::VertexAccessor
|
|
||||||
const> Option<VertexAccessor const>::map<barrier::VertexAccessor const>()':
|
|
||||||
/home/ktf/Workspace/memgraph/include/utils/option.hpp:111: undefined reference
|
|
||||||
to `barrier::VertexAccessor::VertexAccessor<VertexAccessor const>(VertexAccessor
|
|
||||||
const&&)'
|
|
||||||
|
|
||||||
# description:
|
|
||||||
Constructor VertexAccessor<::VertexAccessor const>(::VertexAccessor const&&)
|
|
||||||
isn't written.
|
|
||||||
|
|
||||||
|
|
||||||
### error:
|
|
||||||
../libmemgraph.a(barrier.cpp.o): In function `barrier::EdgeAccessor::from()
|
|
||||||
const':
|
|
||||||
/home/ktf/Workspace/memgraph/src/barrier/barrier.cpp:501: undefined reference to
|
|
||||||
`barrier::VertexAccessor::VertexAccessor<barrier::VertexAccessor
|
|
||||||
const>(barrier::VertexAccessor const&&)'
|
|
||||||
|
|
||||||
# description:
|
|
||||||
Move constructor VertexAccessor<VertexAccessor const>(VertexAccessor const&&)
|
|
||||||
isn't defined.
|
|
||||||
|
|
||||||
|
|
||||||
### error:
|
|
||||||
/home/ktf/Workspace/memgraph/src/barrier/barrier.cpp:282:12: error: call to
|
|
||||||
'trans' is ambiguous
|
|
||||||
return CALL(at(trans(key)));
|
|
||||||
^~~~~~~~~~~~~~~~~~~~
|
|
||||||
/home/ktf/Workspace/memgraph/src/barrier/barrier.cpp:18:17: note: expanded from
|
|
||||||
macro 'CALL'
|
|
||||||
#define CALL(x) trans(HALF_CALL(x))
|
|
||||||
^~~~~
|
|
||||||
/home/ktf/Workspace/memgraph/include/barrier/trans.hpp:208:21: note: candidate
|
|
||||||
function
|
|
||||||
DUP(VertexAccessor, TRANSFORM_VALUE);
|
|
||||||
^
|
|
||||||
/home/ktf/Workspace/memgraph/include/barrier/trans.hpp:169:21: note: candidate
|
|
||||||
function
|
|
||||||
DUP(VertexAccessor, TRANSFORM_REF);
|
|
||||||
^
|
|
||||||
/home/ktf/Workspace/memgraph/include/barrier/trans.hpp:170:19: note: candidate
|
|
||||||
function
|
|
||||||
DUP(EdgeAccessor, TRANSFORM_REF);
|
|
||||||
^
|
|
||||||
/home/ktf/Workspace/memgraph/include/barrier/trans.hpp:174:1: note: candidate
|
|
||||||
function
|
|
||||||
TRANSFORM_REF(VertexPropertyKey,
|
|
||||||
^
|
|
||||||
/home/ktf/Workspace/memgraph/include/barrier/trans.hpp:25:14: note: expanded
|
|
||||||
from macro 'TRANSFORM_REF'
|
|
||||||
y const &trans(x const &l) { return ref_as<y const>(l); } \
|
|
||||||
^
|
|
||||||
/home/ktf/Workspace/memgraph/include/barrier/trans.hpp:176:1: note: candidate
|
|
||||||
function
|
|
||||||
TRANSFORM_REF(EdgePropertyKey,
|
|
||||||
^
|
|
||||||
/home/ktf/Workspace/memgraph/include/barrier/trans.hpp:25:14: note: expanded
|
|
||||||
from macro 'TRANSFORM_REF'
|
|
||||||
y const &trans(x const &l) { return ref_as<y const>(l); } \
|
|
||||||
^
|
|
||||||
/home/ktf/Workspace/memgraph/include/barrier/trans.hpp:182:1: note: candidate
|
|
||||||
function
|
|
||||||
TRANSFORM_REF(VertexIterator, ::iter::Virtual<const ::VertexAccessor>);
|
|
||||||
^
|
|
||||||
/home/ktf/Workspace/memgraph/include/barrier/trans.hpp:23:14: note: expanded
|
|
||||||
from macro 'TRANSFORM_REF'
|
|
||||||
x const &trans(y const &l) { return ref_as<x const>(l); } \
|
|
||||||
...
|
|
||||||
|
|
||||||
# description:
|
|
||||||
There is no valid transformation for types on which trans is called.
|
|
||||||
|
|
||||||
*/
|
|
@ -31,13 +31,27 @@ State *Executor::run(Session &session)
|
|||||||
return this->run(session, q);
|
return this->run(session, q);
|
||||||
// TODO: RETURN success MAYBE
|
// TODO: RETURN success MAYBE
|
||||||
}
|
}
|
||||||
catch (QueryEngineException &e)
|
catch (const CypherLexicalError &e)
|
||||||
|
{
|
||||||
|
session.output_stream.write_failure(
|
||||||
|
{{"code", "Memgraph.CypherLexicalError"},
|
||||||
|
{"message", e.what()}});
|
||||||
|
session.output_stream.send();
|
||||||
|
return session.bolt.states.error.get();
|
||||||
|
}
|
||||||
|
catch (const QueryEngineException &e)
|
||||||
{
|
{
|
||||||
session.output_stream.write_failure(
|
session.output_stream.write_failure(
|
||||||
{{"code", "Memgraph.QueryEngineException"},
|
{{"code", "Memgraph.QueryEngineException"},
|
||||||
{"message", e.what()}});
|
{"message", e.what()}});
|
||||||
session.output_stream.send();
|
session.output_stream.send();
|
||||||
return session.bolt.states.error.get();
|
return session.bolt.states.error.get();
|
||||||
|
} catch (std::exception &e) {
|
||||||
|
session.output_stream.write_failure(
|
||||||
|
{{"code", "Memgraph.Exception"},
|
||||||
|
{"message", e.what()}});
|
||||||
|
session.output_stream.send();
|
||||||
|
return session.bolt.states.error.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (message_type == MessageCode::PullAll)
|
else if (message_type == MessageCode::PullAll)
|
||||||
|
@ -90,7 +90,7 @@ std::string BoltDecoder::read_string()
|
|||||||
size = marker & 0x0F;
|
size = marker & 0x0F;
|
||||||
}
|
}
|
||||||
// if the marker is 0xD0, size is an 8-bit unsigned integer
|
// if the marker is 0xD0, size is an 8-bit unsigned integer
|
||||||
if (marker == pack::String8) {
|
else if (marker == pack::String8) {
|
||||||
size = read_byte();
|
size = read_byte();
|
||||||
}
|
}
|
||||||
// if the marker is 0xD1, size is a 16-bit big-endian unsigned integer
|
// if the marker is 0xD1, size is a 16-bit big-endian unsigned integer
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
#include "utils/iterator/iterator.hpp"
|
#include "utils/iterator/iterator.hpp"
|
||||||
|
|
||||||
DbAccessor::DbAccessor(Db &db)
|
DbAccessor::DbAccessor(Db &db)
|
||||||
: db_transaction(DbTransaction(db, db.tx_engine.begin()))
|
: db_transaction(std::move(DbTransaction(db, db.tx_engine.begin())))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
DbAccessor::DbAccessor(Db &db, tx::Transaction &t)
|
DbAccessor::DbAccessor(Db &db, tx::Transaction &t)
|
||||||
: db_transaction(DbTransaction(db, t))
|
: db_transaction(std::move(DbTransaction(db, t)))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,6 +105,11 @@ DbAccessor::edge_property_key(const std::string &name, Type type)
|
|||||||
return edge_property_family_get(name).get(type).family_key();
|
return edge_property_family_get(name).get(type).family_key();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DbAccessor::update_indexes()
|
||||||
|
{
|
||||||
|
return db_transaction.update_indexes();
|
||||||
|
}
|
||||||
|
|
||||||
// TRANSACTION METHODS
|
// TRANSACTION METHODS
|
||||||
bool DbAccessor::commit()
|
bool DbAccessor::commit()
|
||||||
{
|
{
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user