diff --git a/services/blob/CMakeLists.txt b/services/blob/CMakeLists.txt --- a/services/blob/CMakeLists.txt +++ b/services/blob/CMakeLists.txt @@ -14,42 +14,60 @@ set(WITH_GTEST "Use Google Test" OFF) # FIND LIBS -include(./cmake-components/grpc.cmake) -include(./cmake-components/folly.cmake) -add_subdirectory(./lib/glog) +find_package(glog REQUIRED) +find_package(gRPC REQUIRED) +find_package(Folly REQUIRED) find_package(AWSSDK REQUIRED COMPONENTS s3 core dynamodb) find_package(Boost 1.40 COMPONENTS program_options REQUIRED) find_package(OpenSSL REQUIRED) +find_package(double-conversion REQUIRED) + +# Reference native/cpp projects +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../native/cpp + ${CMAKE_CURRENT_BINARY_DIR}/cpp # CMake's build directory + EXCLUDE_FROM_ALL # Don't build everything, just what we need +) + +# Reference native/cpp projects +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../lib/src + ${CMAKE_CURRENT_BINARY_DIR}/common # CMake's build directory + EXCLUDE_FROM_ALL # Don't build everything, just what we need +) # FIND FILES file(GLOB DOUBLE_CONVERSION_SOURCES "./lib/double-conversion/double-conversion/*.cc") - -file(GLOB GENERATED_CODE "./_generated/*.cc") +file(GLOB COMMON_CODE "${CMAKE_CURRENT_SOURCE_DIR}/../lib/src/*.cpp") file(GLOB_RECURSE SOURCE_CODE "./src/*.cpp") -include_directories( - ./src - ./src/server-base-reactors - ./src/DatabaseEntities - ./src/Reactors/ - ./src/Reactors/server - ./src/Reactors/server/base-reactors - ./_generated - ${FOLLY_INCLUDES} - ./lib/double-conversion - ${Boost_INCLUDE_DIR} -) - # SERVER add_executable( blob - + ${GENERATED_CODE} ${DOUBLE_CONVERSION_SOURCES} ${FOLLY_SOURCES} - + ${SOURCE_CODE} + ${COMMON_CODE} +) + +target_include_directories( + blob + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/src + ${CMAKE_CURRENT_SOURCE_DIR}/src/server-base-reactors + ${CMAKE_CURRENT_SOURCE_DIR}/src/DatabaseEntities + ${CMAKE_CURRENT_SOURCE_DIR}/src/Reactors/ + ${CMAKE_CURRENT_SOURCE_DIR}/src/Reactors/server + ${CMAKE_CURRENT_SOURCE_DIR}/src/Reactors/server/base-reactors + + # Ideally, we would add comm-services-common as a + # target link library, however, aws-sdk seems to not be able + # to be linked transitively + ${CMAKE_CURRENT_SOURCE_DIR}/../lib/src + + ${Boost_INCLUDE_DIR} ) set( @@ -60,6 +78,13 @@ ${Boost_LIBRARIES} OpenSSL::SSL glog::glog + gRPC::grpc++ + double-conversion::double-conversion + Folly::folly + + #comm-services-common + comm-blob-grpc + comm-server-base-reactors ) target_link_libraries( diff --git a/services/blob/src/BlobServiceImpl.h b/services/blob/src/BlobServiceImpl.h --- a/services/blob/src/BlobServiceImpl.h +++ b/services/blob/src/BlobServiceImpl.h @@ -2,8 +2,8 @@ #include "S3Path.h" -#include "../_generated/blob.grpc.pb.h" -#include "../_generated/blob.pb.h" +#include +#include #include diff --git a/services/blob/src/DatabaseEntities/DatabaseEntitiesTools.h b/services/blob/src/DatabaseEntities/DatabaseEntitiesTools.h deleted file mode 100644 --- a/services/blob/src/DatabaseEntities/DatabaseEntitiesTools.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once - -#include "Item.h" - -#include "BlobItem.h" -#include "ReverseIndexItem.h" - -#include -#include - -namespace comm { -namespace network { -namespace database { - -/** - * Database Structure: - * blob - * blobHash string - * s3Path string - * created timestamp - * reverse_index - * holder string - * blobHash string - */ - -template std::shared_ptr createItemByType() { - static_assert(std::is_base_of::value, "T must inherit from Item"); - return std::make_shared(); -} - -} // namespace database -} // namespace network -} // namespace comm diff --git a/services/blob/src/DatabaseManager.h b/services/blob/src/DatabaseManager.h --- a/services/blob/src/DatabaseManager.h +++ b/services/blob/src/DatabaseManager.h @@ -1,8 +1,10 @@ #pragma once +#include "BlobItem.h" #include "DatabaseEntitiesTools.h" #include "DatabaseManagerBase.h" #include "DynamoDBTools.h" +#include "ReverseIndexItem.h" #include #include diff --git a/services/blob/src/Reactors/server/GetReactor.h b/services/blob/src/Reactors/server/GetReactor.h --- a/services/blob/src/Reactors/server/GetReactor.h +++ b/services/blob/src/Reactors/server/GetReactor.h @@ -2,10 +2,10 @@ #include "GlobalConstants.h" #include "S3Tools.h" -#include "ServerWriteReactorBase.h" +#include -#include "../_generated/blob.grpc.pb.h" -#include "../_generated/blob.pb.h" +#include +#include #include diff --git a/services/blob/src/Tools.h b/services/blob/src/Tools.h --- a/services/blob/src/Tools.h +++ b/services/blob/src/Tools.h @@ -1,6 +1,7 @@ #pragma once #include "DatabaseEntitiesTools.h" +#include "ReverseIndexItem.h" #include "S3Path.h" namespace comm {