Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3384426
D4493.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D4493.diff
View Options
diff --git a/services/blob/CMakeLists.txt b/services/blob/CMakeLists.txt
--- a/services/blob/CMakeLists.txt
+++ b/services/blob/CMakeLists.txt
@@ -2,6 +2,7 @@
cmake_minimum_required(VERSION 3.16)
+set(CMAKE_CXX_STANDARD 14)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin)
if(COMMAND cmake_policy)
@@ -14,35 +15,45 @@
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(protobuf 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(Boost 1.40
+ COMPONENTS program_options filesystem context regex system thread
+ REQUIRE
+)
find_package(OpenSSL REQUIRED)
+find_package(double-conversion REQUIRED)
+
+if(${CMAKE_CURRENT_SOURCE_DIR} MATCHES "^\/transferred.*")
+ # Inside the docker build contex
+ set(_proto_path "grpc")
+else()
+ # Inside repo
+ set(_proto_path "../../native/cpp/CommonCpp/grpc")
+endif()
+
+# Shared Comm protos
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${_proto_path}
+ ${CMAKE_CURRENT_BINARY_DIR}/protos
+ EXCLUDE_FROM_ALL
+)
+
+# 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
@@ -52,6 +63,25 @@
${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(
@@ -62,6 +92,12 @@
${Boost_LIBRARIES}
OpenSSL::SSL
glog::glog
+ gRPC::grpc++
+ double-conversion::double-conversion
+ Folly::folly
+
+ comm-blob-grpc
+ comm-server-base-reactors
)
target_link_libraries(
diff --git a/services/blob/Dockerfile b/services/blob/Dockerfile
--- a/services/blob/Dockerfile
+++ b/services/blob/Dockerfile
@@ -1,4 +1,4 @@
-FROM commapp/services-base:1.2
+FROM commapp/services-base:1.3
RUN apt-get update && \
apt-get install -y uuid-dev && \
@@ -12,12 +12,16 @@
WORKDIR /transferred
-COPY native/cpp/CommonCpp/grpc/protos/blob.proto protos/blob.proto
-COPY services/lib/cmake-components cmake-components
COPY services/lib/docker/ scripts/
-COPY services/blob/ .
-COPY services/lib/src/* src/
+COPY services/blob/ blob
+COPY services/lib/src lib/src/
-RUN scripts/build_service.sh
+WORKDIR /transferred/blob
+
+ADD native/cpp/CommonCpp/grpc grpc
+
+RUN ../scripts/build_service.sh
+
+WORKDIR /transferred
CMD if [ "$COMM_TEST_SERVICES" -eq 1 ]; then scripts/run_tests.sh; else scripts/run_service.sh; fi
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 <blob.grpc.pb.h>
+#include <blob.pb.h>
#include <aws/core/Aws.h>
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 <memory>
-#include <type_traits>
-
-namespace comm {
-namespace network {
-namespace database {
-
-/**
- * Database Structure:
- * blob
- * blobHash string
- * s3Path string
- * created timestamp
- * reverse_index
- * holder string
- * blobHash string
- */
-
-template <typename T> std::shared_ptr<T> createItemByType() {
- static_assert(std::is_base_of<Item, T>::value, "T must inherit from Item");
- return std::make_shared<T>();
-}
-
-} // 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 <aws/core/Aws.h>
#include <aws/dynamodb/model/AttributeDefinition.h>
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 <ServerWriteReactorBase.h>
-#include "../_generated/blob.grpc.pb.h"
-#include "../_generated/blob.pb.h"
+#include <blob.grpc.pb.h>
+#include <blob.pb.h>
#include <aws/s3/model/GetObjectRequest.h>
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 {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 29, 8:58 PM (20 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2598134
Default Alt Text
D4493.diff (6 KB)
Attached To
Mode
D4493: [Services] Update blob CMake project
Attached
Detach File
Event Timeline
Log In to Comment