All files for the Release are now isolated
This commit is contained in:
parent
95aa385e31
commit
869da8dcda
1
.gitignore
vendored
1
.gitignore
vendored
@ -14,3 +14,4 @@ memgraph
|
||||
tags
|
||||
.gdb_history
|
||||
Testing/
|
||||
ve/
|
||||
|
215
CMakeLists.txt
215
CMakeLists.txt
@ -116,19 +116,22 @@ FILE(MAKE_DIRECTORY ${cypher_build_include_dir})
|
||||
FILE(RENAME ${CMAKE_BINARY_DIR}/cypher.h ${cypher_build_include_dir}/cypher.h)
|
||||
|
||||
# prepare template and destination folders for query engine (tests)
|
||||
# and memgraph server binary
|
||||
# copy query_engine's templates file
|
||||
FILE(COPY ${src_dir}/query_engine/template DESTINATION ${CMAKE_BINARY_DIR}/tests)
|
||||
FILE(COPY ${src_dir}/query_engine/template DESTINATION ${CMAKE_BINARY_DIR})
|
||||
# create destination folder for compiled queries
|
||||
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/tests/compiled/cpu)
|
||||
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/compiled/cpu)
|
||||
|
||||
# TODO: filter header files, all files don't need to be copied
|
||||
# they are all copied because query engine needs header files during
|
||||
# query compilation
|
||||
# TODO: make a function (REMOVE copy pasted part)
|
||||
SUBDIRLIST(source_folders ${src_dir})
|
||||
foreach(source_folder ${source_folders})
|
||||
file(COPY ${src_dir}/${source_folder} DESTINATION ${build_include_dir})
|
||||
endforeach()
|
||||
# SUBDIRLIST(source_folders ${src_dir})
|
||||
# foreach(source_folder ${source_folders})
|
||||
# file(COPY ${src_dir}/${source_folder} DESTINATION ${build_include_dir})
|
||||
# endforeach()
|
||||
SUBDIRLIST(source_folders ${src_dir})
|
||||
foreach(source_folder ${source_folders})
|
||||
file(COPY ${src_dir}/${source_folder} DESTINATION ${test_src_dir})
|
||||
@ -138,16 +141,130 @@ foreach(source_foler ${source_folders})
|
||||
file(COPY ${include_dir}/${source_folder} DESTINATION ${test_include_dir})
|
||||
endforeach()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 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}/database/db.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_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}/query_engine/util.hpp DESTINATION ${build_include_dir}/query_engine)
|
||||
FILE(COPY ${include_dir}/query_engine/i_code_cpu.hpp DESTINATION ${build_include_dir}/query_engine)
|
||||
FILE(COPY ${include_dir}/query_engine/query_result.hpp DESTINATION ${build_include_dir}/query_engine)
|
||||
FILE(COPY ${include_dir}/query_engine/query_stripped.hpp DESTINATION ${build_include_dir}/query_engine)
|
||||
|
||||
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/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/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}/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/handler.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/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/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/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.hpp DESTINATION ${build_include_dir}/storage/indexes)
|
||||
FILE(COPY ${include_dir}/storage/indexes/index_record.hpp DESTINATION ${build_include_dir}/storage/indexes)
|
||||
FILE(COPY ${include_dir}/storage/indexes/index_record_collection.hpp DESTINATION ${build_include_dir}/storage/indexes)
|
||||
|
||||
FILE(COPY ${include_dir}/utils/sys.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)
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# 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}")
|
||||
|
||||
# compiler options
|
||||
# SET(COMPILE_OPTIONS "-O2 -Wall -Werror -fmessage-length=0")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=native")
|
||||
# debug flags
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
# set(CMAKE_CXX_FLAGS_DEBUG "-Wl,--export-dynamic ${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
# set(CMAKE_CXX_FLAGS_DEBUG "-rdynamic ${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
endif()
|
||||
|
||||
# manual defines at configure time
|
||||
# release flags
|
||||
set(CMAKE_CXX_FLAGS_RELEASE
|
||||
"${CMAKE_CXX_FLAGS_RELEASE} -march=native -Wall -Werror")
|
||||
|
||||
# -- configure time variables -------------------------------------------------
|
||||
option(RUNTIME_ASSERT "Enable runtime assertions" OFF)
|
||||
if(RUNTIME_ASSERT)
|
||||
add_definitions( -DRUNTIME_ASSERT_ON )
|
||||
@ -163,7 +280,11 @@ if(NDEBUG)
|
||||
add_definitions( -DNDEBUG )
|
||||
endif()
|
||||
|
||||
# includes
|
||||
option(MEMGRAPH "Build memgraph binary" ON)
|
||||
option(POC "Build proof of concept binaries" ON)
|
||||
option(TESTS "Build test binaries" ON)
|
||||
|
||||
# -- includes -----------------------------------------------------------------
|
||||
include_directories(${CMAKE_SOURCE_DIR}/include)
|
||||
include_directories(${src_dir})
|
||||
include_directories(${build_include_dir})
|
||||
@ -173,6 +294,7 @@ include_directories(${lexertl_dir})
|
||||
include_directories(${libuv_source_dir}/include)
|
||||
include_directories(${rapidjson_source_dir}/include)
|
||||
include_directories(${r3_source_dir}/include)
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# creates build/libcypher_lib.a
|
||||
add_library(cypher_lib STATIC ${CMAKE_BINARY_DIR}/cypher.cpp)
|
||||
@ -183,30 +305,24 @@ EXECUTE_PROCESS(
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/api
|
||||
)
|
||||
|
||||
# # memgraph executable
|
||||
# add_executable(memgraph_http src/memgraph.cpp)
|
||||
# add_dependencies(memgraph_http cypher_lib)
|
||||
# target_link_libraries(memgraph_http Threads::Threads)
|
||||
# target_link_libraries(memgraph_http pcre)
|
||||
# target_link_libraries(memgraph_http ${libuv_static_lib})
|
||||
# target_link_libraries(memgraph_http ${r3_static_lib})
|
||||
# target_link_libraries(memgraph_http ${http_parser_static_lib})
|
||||
|
||||
# # query_engine executable
|
||||
# add_executable(query_engine src/query_engine/main_query_engine.cpp)
|
||||
# # query_engine link libraries
|
||||
# target_link_libraries(query_engine Threads::Threads)
|
||||
# target_link_libraries(query_engine dl)
|
||||
# target_link_libraries(query_engine cypher_lib)
|
||||
# target_link_libraries(query_engine ${fmt_static_lib})
|
||||
|
||||
# # query hasher executable
|
||||
# add_executable(query_hasher src/query_engine/main_query_hasher.cpp)
|
||||
# target_link_libraries(query_hasher ${fmt_static_lib})
|
||||
|
||||
# TODO: create separate static library from bolt code
|
||||
set(memgraph_src_files
|
||||
${src_dir}/utils/string/transform.cpp
|
||||
${src_dir}/utils/string/join.cpp
|
||||
${src_dir}/utils/string/file.cpp
|
||||
${src_dir}/query_engine/util.cpp
|
||||
${src_dir}/bolt/v1/bolt.cpp
|
||||
${src_dir}/bolt/v1/states.cpp
|
||||
${src_dir}/bolt/v1/session.cpp
|
||||
${src_dir}/bolt/v1/states/error.cpp
|
||||
${src_dir}/bolt/v1/states/executor.cpp
|
||||
${src_dir}/bolt/v1/states/init.cpp
|
||||
${src_dir}/bolt/v1/states/handshake.cpp
|
||||
${src_dir}/bolt/v1/transport/bolt_decoder.cpp
|
||||
${src_dir}/bolt/v1/transport/buffer.cpp
|
||||
${src_dir}/mvcc/id.cpp
|
||||
${src_dir}/storage/vertices.cpp
|
||||
${src_dir}/storage/edges.cpp
|
||||
${src_dir}/storage/label/label.cpp
|
||||
${src_dir}/storage/label/label_collection.cpp
|
||||
${src_dir}/storage/label/label_store.cpp
|
||||
@ -221,6 +337,13 @@ set(memgraph_src_files
|
||||
${src_dir}/storage/vertex_accessor.cpp
|
||||
${src_dir}/transactions/transaction.cpp
|
||||
${src_dir}/template_engine/engine.cpp
|
||||
${src_dir}/logging/streams/stdout.cpp
|
||||
${src_dir}/logging/levels.cpp
|
||||
${src_dir}/logging/logs/sync_log.cpp
|
||||
${src_dir}/logging/logs/async_log.cpp
|
||||
${src_dir}/logging/default.cpp
|
||||
${src_dir}/logging/log.cpp
|
||||
${src_dir}/io/network/tls.cpp
|
||||
)
|
||||
|
||||
# STATIC library used by memgraph executables
|
||||
@ -231,11 +354,15 @@ add_library(memgraph_pic STATIC ${memgraph_src_files})
|
||||
set_property(TARGET memgraph_pic PROPERTY POSITION_INDEPENDENT_CODE TRUE)
|
||||
|
||||
# tests
|
||||
if (TESTS)
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
# proof of concept
|
||||
# proof of concepts
|
||||
if (POC)
|
||||
add_subdirectory(poc)
|
||||
endif()
|
||||
|
||||
# memgraph build name
|
||||
execute_process(
|
||||
@ -248,8 +375,28 @@ execute_process(
|
||||
)
|
||||
string(STRIP ${COMMIT_HASH} COMMIT_HASH)
|
||||
string(STRIP ${COMMIT_NO} COMMIT_NO)
|
||||
set(MEMGRAPH_BUILD_NAME "memgraph_${COMMIT_HASH}_${COMMIT_NO}")
|
||||
message(STATUS ${CMAKE_BUILD_TYPE})
|
||||
set(MEMGRAPH_BUILD_NAME
|
||||
"memgraph_${COMMIT_HASH}_${COMMIT_NO}_${CMAKE_BUILD_TYPE}")
|
||||
|
||||
# memgraph main executable
|
||||
add_executable(${MEMGRAPH_BUILD_NAME}_${CMAKE_BUILD_TYPE} ${src_dir}/memgraph_bolt.cpp)
|
||||
if (MEMGRAPH)
|
||||
add_executable(${MEMGRAPH_BUILD_NAME} ${src_dir}/memgraph_bolt.cpp)
|
||||
target_link_libraries(${MEMGRAPH_BUILD_NAME} memgraph)
|
||||
target_link_libraries(${MEMGRAPH_BUILD_NAME} Threads::Threads)
|
||||
target_link_libraries(${MEMGRAPH_BUILD_NAME} cypher_lib)
|
||||
if (UNIX)
|
||||
target_link_libraries(${MEMGRAPH_BUILD_NAME} crypto)
|
||||
# target_link_libraries(${MEMGRAPH_BUILD_NAME} ssl)
|
||||
target_link_libraries(${MEMGRAPH_BUILD_NAME} ${fmt_static_lib})
|
||||
target_link_libraries(${MEMGRAPH_BUILD_NAME} dl)
|
||||
endif (UNIX)
|
||||
endif()
|
||||
|
||||
# # memgraph executable HTTP TODO: DEPRICATED
|
||||
# add_executable(memgraph_http src/memgraph.cpp)
|
||||
# add_dependencies(memgraph_http cypher_lib)
|
||||
# target_link_libraries(memgraph_http Threads::Threads)
|
||||
# target_link_libraries(memgraph_http pcre)
|
||||
# target_link_libraries(memgraph_http ${libuv_static_lib})
|
||||
# target_link_libraries(memgraph_http ${r3_static_lib})
|
||||
# target_link_libraries(memgraph_http ${http_parser_static_lib})
|
||||
|
@ -20,6 +20,10 @@ on a 64 bit linux kernel.
|
||||
* lemon (parser generator)
|
||||
* catch (for compiling tests)
|
||||
|
||||
### Bolt
|
||||
|
||||
sudo apt-get install libssl-dev
|
||||
|
||||
## build
|
||||
```
|
||||
cd build
|
||||
@ -30,8 +34,9 @@ cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DRUNTIME_ASSERT=OFF
|
||||
# -DCMAKE_CXX_COMPILER=clang++
|
||||
# -DRUNTIME_ASSERT=OFF
|
||||
# -DTHROW_EXCEPTION_ON_ERROR=OFF
|
||||
# -DCMAKE_BUILD_TYPE:STRING=Debug
|
||||
# -DNDEBUG=ON
|
||||
# -DCMAKE_BUILD_TYPE:STRING=debug
|
||||
# -DCMAKE_BUILD_TYPE:STRING=release
|
||||
|
||||
make
|
||||
ctest
|
||||
|
@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "states.hpp"
|
||||
#include "bolt/v1/states.hpp"
|
||||
#include "io/network/socket.hpp"
|
||||
#include "dbms/dbms.hpp"
|
||||
|
||||
namespace bolt
|
||||
{
|
||||
@ -19,6 +20,7 @@ public:
|
||||
void close(Session* session);
|
||||
|
||||
States states;
|
||||
Dbms dbms;
|
||||
};
|
||||
|
||||
}
|
8
include/bolt/v1/messaging/messages.hpp
Normal file
8
include/bolt/v1/messaging/messages.hpp
Normal file
@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
namespace bolt
|
||||
{
|
||||
|
||||
// TODO: what should be here? (Question for Dominik)
|
||||
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
#include "bolt/v1/transport/bolt_encoder.hpp"
|
||||
#include "bolt/v1/packing/codes.hpp"
|
||||
|
||||
#include "include/storage/vertex_accessor.hpp"
|
||||
#include "storage/vertex_accessor.hpp"
|
||||
#include "storage/edge_accessor.hpp"
|
||||
|
||||
#include "storage/model/properties/properties.hpp"
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "bolt_serializer.hpp"
|
||||
#include "bolt/v1/serialization/bolt_serializer.hpp"
|
||||
|
||||
namespace bolt
|
||||
{
|
@ -4,13 +4,11 @@
|
||||
#include "io/network/socket.hpp"
|
||||
|
||||
#include "bolt/v1/states/state.hpp"
|
||||
|
||||
#include "bolt/v1/transport/bolt_decoder.hpp"
|
||||
#include "bolt/v1/transport/bolt_encoder.hpp"
|
||||
|
||||
#include "bolt/v1/serialization/socket_serializer.hpp"
|
||||
#include "bolt/v1/bolt.hpp"
|
||||
|
||||
#include "bolt.hpp"
|
||||
#include "logging/default.hpp"
|
||||
|
||||
namespace bolt
|
||||
@ -31,6 +29,8 @@ public:
|
||||
|
||||
Bolt& bolt;
|
||||
|
||||
Db& active_db();
|
||||
|
||||
Decoder decoder;
|
||||
Encoder encoder {socket};
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "states/state.hpp"
|
||||
#include "bolt/v1/states/state.hpp"
|
||||
#include "logging/log.hpp"
|
||||
|
||||
namespace bolt
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "bolt/v1/session.hpp"
|
||||
#include "bolt/v1/states/state.hpp"
|
||||
|
||||
namespace bolt
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "bolt/v1/states/state.hpp"
|
||||
#include "bolt/v1/session.hpp"
|
||||
#include "query_engine/query_engine.hpp"
|
||||
|
||||
namespace bolt
|
||||
{
|
||||
@ -35,6 +36,10 @@ protected:
|
||||
*
|
||||
*/
|
||||
void discard_all(Session& session);
|
||||
|
||||
private:
|
||||
QueryEngine query_engine;
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -1,9 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "state.hpp"
|
||||
#include "utils/crtp.hpp"
|
||||
|
||||
#include "bolt/v1/session.hpp"
|
||||
#include "bolt/v1/states/state.hpp"
|
||||
#include "utils/crtp.hpp"
|
||||
|
||||
namespace bolt
|
||||
{
|
||||
@ -12,8 +11,7 @@ template <class Derived>
|
||||
class MessageParser : public State, public Crtp<Derived>
|
||||
{
|
||||
public:
|
||||
MessageParser(Logger&& logger)
|
||||
: logger(std::forward<Logger>(logger)) {}
|
||||
MessageParser(Logger &&logger) : logger(std::forward<Logger>(logger)) {}
|
||||
|
||||
State *run(Session &session) override final
|
||||
{
|
||||
@ -23,8 +21,7 @@ public:
|
||||
auto next = this->derived().parse(session, message);
|
||||
|
||||
// return next state if parsing was unsuccessful (i.e. error state)
|
||||
if(next != &this->derived())
|
||||
return next;
|
||||
if (next != &this->derived()) return next;
|
||||
|
||||
logger.debug("Executing state");
|
||||
return this->derived().execute(session, message);
|
||||
@ -33,5 +30,4 @@ public:
|
||||
protected:
|
||||
Logger logger;
|
||||
};
|
||||
|
||||
}
|
@ -1,8 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "buffer.hpp"
|
||||
#include "chunked_decoder.hpp"
|
||||
|
||||
#include "bolt/v1/transport/buffer.hpp"
|
||||
#include "bolt/v1/transport/chunked_decoder.hpp"
|
||||
#include "utils/types/byte.hpp"
|
||||
|
||||
namespace bolt
|
||||
@ -41,5 +40,4 @@ private:
|
||||
|
||||
const byte *raw() const;
|
||||
};
|
||||
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
#include <cstdio>
|
||||
|
||||
#include "io/network/socket.hpp"
|
||||
#include "stream_error.hpp"
|
||||
#include "bolt/v1/transport/stream_error.hpp"
|
||||
|
||||
namespace bolt
|
||||
{
|
@ -16,7 +16,6 @@ public:
|
||||
|
||||
friend constexpr bool operator<(const Item &lhs, const Item &rhs)
|
||||
{
|
||||
std::pair<const K, T> *a;
|
||||
return lhs.first < rhs.first;
|
||||
}
|
||||
|
@ -9,12 +9,18 @@ class Db
|
||||
public:
|
||||
using sptr = std::shared_ptr<Db>;
|
||||
|
||||
Db() = default;
|
||||
Db(const std::string& name) : name_(name) {}
|
||||
Db(const Db& db) = delete;
|
||||
|
||||
Graph graph;
|
||||
tx::Engine tx_engine;
|
||||
|
||||
// only for test purposes
|
||||
std::string identifier()
|
||||
std::string& name()
|
||||
{
|
||||
return "memgraph";
|
||||
return name_;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string name_;
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "log.hpp"
|
||||
#include "logger.hpp"
|
||||
#include "logging/log.hpp"
|
||||
#include "logging/logger.hpp"
|
||||
|
||||
namespace logging
|
||||
{
|
@ -3,8 +3,8 @@
|
||||
#include <cassert>
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "log.hpp"
|
||||
#include "levels.hpp"
|
||||
#include "logging/log.hpp"
|
||||
#include "logging/levels.hpp"
|
||||
|
||||
class Logger
|
||||
{
|
@ -8,9 +8,9 @@
|
||||
#include "transactions/engine.hpp"
|
||||
|
||||
#include "mvcc/id.hpp"
|
||||
#include "cre_exp.hpp"
|
||||
#include "version.hpp"
|
||||
#include "hints.hpp"
|
||||
#include "mvcc/cre_exp.hpp"
|
||||
#include "mvcc/version.hpp"
|
||||
#include "mvcc/hints.hpp"
|
||||
#include "storage/locking/record_lock.hpp"
|
||||
|
||||
// the mvcc implementation used here is very much like postgresql's
|
@ -19,11 +19,11 @@ public:
|
||||
auto compile_command =
|
||||
utils::prints("clang++",
|
||||
// "-std=c++1y -O2 -DNDEBUG", // compile flags
|
||||
"-std=c++1y -DDEBUG", // compile flags
|
||||
"-std=c++1y -DDEBUG", // compile flags // TODO: load from config file
|
||||
in_file, // input file
|
||||
"-o", out_file, // ouput file
|
||||
"-I./include", // include paths (TODO: parameter)
|
||||
"-I./src", "-I../../libs/fmt",
|
||||
"-I../libs/fmt", // TODO: load from config
|
||||
"-L./ -lmemgraph_pic",
|
||||
"-shared -fPIC" // shared library flags
|
||||
);
|
@ -15,6 +15,9 @@
|
||||
using ParameterIndexKey::Type::InternalId;
|
||||
using Direction = RelationshipData::Direction;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
auto update_properties(const QueryActionData &action_data,
|
||||
const std::string &name)
|
||||
{
|
||||
@ -29,3 +32,5 @@ auto update_properties(const QueryActionData &action_data,
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
}
|
@ -2,6 +2,9 @@
|
||||
|
||||
#include "query_engine/code_generator/handlers/includes.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
bool already_matched(CypherStateData &cypher_data, const std::string &name,
|
||||
EntityType type)
|
||||
{
|
||||
@ -18,6 +21,8 @@ auto fetch_internal_index(const QueryActionData &action_data,
|
||||
return action_data.parameter_index.at(ParameterIndexKey(InternalId, name));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
auto match_query_action =
|
||||
[](CypherStateData &cypher_data,
|
||||
const QueryActionData &action_data) -> std::string {
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "database/db.hpp"
|
||||
#include "query_engine/query_result.hpp"
|
||||
#include "query_stripped.hpp"
|
||||
#include "query_engine/query_stripped.hpp"
|
||||
|
||||
class ICodeCPU
|
||||
{
|
@ -1,8 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "i_code_cpu.hpp"
|
||||
#include "query_engine/i_code_cpu.hpp"
|
||||
#include "dc/dynamic_lib.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
class MemgraphDynamicLib
|
||||
{
|
||||
public:
|
||||
@ -16,3 +19,5 @@ const std::string MemgraphDynamicLib::produce_name = "produce";
|
||||
const std::string MemgraphDynamicLib::destruct_name = "destruct";
|
||||
|
||||
using CodeLib = DynamicLib<MemgraphDynamicLib>;
|
||||
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
class ProgramExecutor
|
||||
{
|
||||
public:
|
||||
auto execute(QueryProgram &program)
|
||||
auto execute(QueryProgram &program, Db& db)
|
||||
{
|
||||
try {
|
||||
// TODO: return result of query/code exection
|
||||
@ -25,9 +25,4 @@ public:
|
||||
throw QueryEngineException("code execution error");
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
// TODO: here shoud be one database from DBMS, not local instance of
|
||||
// DB
|
||||
Db db;
|
||||
};
|
@ -6,12 +6,12 @@
|
||||
|
||||
#define NOT_LOG_INFO
|
||||
|
||||
#include "code_compiler.hpp"
|
||||
#include "code_generator.hpp"
|
||||
#include "config/config.hpp"
|
||||
#include "memgraph_dynamic_lib.hpp"
|
||||
#include "query_program.hpp"
|
||||
#include "query_stripper.hpp"
|
||||
#include "query_engine/code_compiler.hpp"
|
||||
#include "query_engine/code_generator.hpp"
|
||||
#include "query_engine/memgraph_dynamic_lib.hpp"
|
||||
#include "query_engine/query_program.hpp"
|
||||
#include "query_engine/query_stripper.hpp"
|
||||
#include "utils/hashing/fnv.hpp"
|
||||
#include "utils/log/logger.hpp"
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "program_executor.hpp"
|
||||
#include "program_loader.hpp"
|
||||
#include "query_result.hpp"
|
||||
#include "database/db.hpp"
|
||||
|
||||
//
|
||||
// Current arhitecture:
|
||||
@ -17,11 +18,11 @@
|
||||
class QueryEngine
|
||||
{
|
||||
public:
|
||||
auto execute(const std::string &query)
|
||||
auto execute(const std::string &query, Db& db)
|
||||
{
|
||||
// TODO: error handling
|
||||
auto program = program_loader.load(query);
|
||||
auto result = program_executor.execute(program);
|
||||
auto result = program_executor.execute(program, db);
|
||||
return result;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "i_code_cpu.hpp"
|
||||
#include "query_stripped.hpp"
|
||||
#include "query_engine/i_code_cpu.hpp"
|
||||
#include "query_engine/query_stripped.hpp"
|
||||
|
||||
struct QueryProgram
|
||||
{
|
@ -62,15 +62,4 @@ const std::string print_properties =
|
||||
const std::string print_property =
|
||||
"cout_property(\"{0}\", {0}.property(\"{1}\"));";
|
||||
|
||||
std::string debug_print_vertex_labels()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
return code_line("PRINT_PROPS(vertex_accessor.properties());") +
|
||||
code_line("cout << \"LABELS:\" << endl;") +
|
||||
code_line("for (auto label_ref : vertex_accessor.labels()) {") +
|
||||
code_line("cout << label_ref.get() << endl;") + code_line("}");
|
||||
#else
|
||||
return "";
|
||||
#endif
|
||||
}
|
||||
}
|
@ -92,6 +92,13 @@ private:
|
||||
// TODO: remove this constraint
|
||||
bool has_return;
|
||||
|
||||
void finish_query_execution()
|
||||
{
|
||||
generator.add_action(QueryAction::TransactionCommit);
|
||||
code += generator.generate();
|
||||
generator.clear();
|
||||
}
|
||||
|
||||
public:
|
||||
void semantic_check() const
|
||||
{
|
||||
@ -108,6 +115,9 @@ public:
|
||||
generator.add_action(QueryAction::TransactionBegin);
|
||||
|
||||
Traverser::visit(write_query);
|
||||
|
||||
// TODO: put this inside the top level mentioned above
|
||||
finish_query_execution();
|
||||
}
|
||||
|
||||
void visit(ast::ReadQuery &read_query) override
|
||||
@ -115,6 +125,8 @@ public:
|
||||
generator.add_action(QueryAction::TransactionBegin);
|
||||
|
||||
Traverser::visit(read_query);
|
||||
|
||||
finish_query_execution();
|
||||
}
|
||||
|
||||
void visit(ast::UpdateQuery &update_query) override
|
||||
@ -122,6 +134,8 @@ public:
|
||||
generator.add_action(QueryAction::TransactionBegin);
|
||||
|
||||
Traverser::visit(update_query);
|
||||
|
||||
finish_query_execution();
|
||||
}
|
||||
|
||||
void visit(ast::DeleteQuery &delete_query) override
|
||||
@ -129,6 +143,8 @@ public:
|
||||
generator.add_action(QueryAction::TransactionBegin);
|
||||
|
||||
Traverser::visit(delete_query);
|
||||
|
||||
finish_query_execution();
|
||||
}
|
||||
|
||||
void visit(ast::ReadWriteQuery &read_write_query) override
|
||||
@ -136,6 +152,8 @@ public:
|
||||
generator.add_action(QueryAction::TransactionBegin);
|
||||
|
||||
Traverser::visit(read_write_query);
|
||||
|
||||
finish_query_execution();
|
||||
}
|
||||
|
||||
void visit(ast::Match &ast_match) override
|
||||
@ -188,12 +206,6 @@ public:
|
||||
|
||||
Traverser::visit(ast_return);
|
||||
|
||||
// TODO: move commit somewhare that is more appropriate
|
||||
generator.add_action(QueryAction::TransactionCommit);
|
||||
|
||||
code += generator.generate();
|
||||
|
||||
generator.clear();
|
||||
}
|
||||
|
||||
void visit(ast::ReturnList &ast_return_list) override
|
@ -11,46 +11,34 @@
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
void print_props(const Properties &properties)
|
||||
{
|
||||
StringBuffer buffer;
|
||||
JsonWriter<StringBuffer> writer(buffer);
|
||||
properties.accept(writer);
|
||||
cout << buffer.str() << endl;
|
||||
}
|
||||
void print_props(const Properties &properties);
|
||||
|
||||
#ifdef DEBUG
|
||||
#define PRINT_PROPS(_PROPS_) print_props(_PROPS_);
|
||||
#else
|
||||
#ifdef NDEBUG
|
||||
#define PRINT_PROPS(_)
|
||||
#else
|
||||
#define PRINT_PROPS(_PROPS_) print_props(_PROPS_);
|
||||
#endif
|
||||
|
||||
void cout_properties(const Properties &properties)
|
||||
{
|
||||
ConsoleWriter writer;
|
||||
properties.accept(writer);
|
||||
cout << "----" << endl;
|
||||
}
|
||||
void cout_properties(const Properties &properties);
|
||||
|
||||
void cout_property(const std::string &key, const Property &property)
|
||||
{
|
||||
ConsoleWriter writer;
|
||||
writer.handle(key, property);
|
||||
cout << "----" << endl;
|
||||
}
|
||||
void cout_property(const std::string &key, const Property &property);
|
||||
|
||||
// this is a nice way how to avoid multiple definition problem with
|
||||
// headers because it will create a unique namespace for each compilation unit
|
||||
// http://stackoverflow.com/questions/2727582/multiple-definition-in-header-file
|
||||
namespace
|
||||
{
|
||||
|
||||
// wrapper for fmt format
|
||||
template <typename... Args>
|
||||
std::string format(const std::string &format_str, const Args &... args)
|
||||
{
|
||||
return fmt::format(format_str, args...);
|
||||
}
|
||||
|
||||
// wrapper for single code line
|
||||
template <typename... Args>
|
||||
std::string code_line(const std::string &format_str, const Args &... args)
|
||||
{
|
||||
return "\t" + format(format_str, args...) + "\n";
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "mvcc/record.hpp"
|
||||
#include "model/edge_model.hpp"
|
||||
#include "model/properties/traversers/jsonwriter.hpp"
|
||||
#include "storage/model/edge_model.hpp"
|
||||
#include "storage/model/properties/traversers/jsonwriter.hpp"
|
||||
|
||||
class Edge : public mvcc::Record<Edge>
|
||||
{
|
16
include/storage/edges.hpp
Normal file
16
include/storage/edges.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "data_structures/concurrent/concurrent_map.hpp"
|
||||
#include "storage/common.hpp"
|
||||
#include "storage/edge_accessor.hpp"
|
||||
|
||||
class Edges
|
||||
{
|
||||
public:
|
||||
Edge::Accessor find(tx::Transaction &t, const Id &id);
|
||||
Edge::Accessor insert(tx::Transaction &t);
|
||||
|
||||
private:
|
||||
ConcurrentMap<uint64_t, EdgeRecord> edges;
|
||||
AtomicCounter<uint64_t> counter;
|
||||
};
|
@ -10,8 +10,8 @@ class Graph
|
||||
public:
|
||||
Graph() {}
|
||||
|
||||
Edges edges;
|
||||
Vertices vertices;
|
||||
Edges edges;
|
||||
|
||||
LabelStore label_store;
|
||||
EdgeTypeStore edge_type_store;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user