Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3347101
D4494.id15175.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
D4494.id15175.diff
View Options
diff --git a/services/backup/CMakeLists.txt b/services/backup/CMakeLists.txt
--- a/services/backup/CMakeLists.txt
+++ b/services/backup/CMakeLists.txt
@@ -13,51 +13,63 @@
set(BUILD_TESTING OFF CACHE BOOL "Turn off tests" FORCE)
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 core dynamodb)
-find_package(Boost 1.40 COMPONENTS program_options REQUIRED)
-
-# FIND FILES
-file(GLOB DOUBLE_CONVERSION_SOURCES
- "./lib/double-conversion/double-conversion/*.cc"
+find_package(Boost 1.40
+ COMPONENTS program_options context filesystem regex system thread
+ REQUIRED
)
-file(GLOB GENERATED_CODE "./_generated/*.cc")
+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()
-file(GLOB_RECURSE SOURCE_CODE "./src/*.cpp")
+# Shared Comm protos
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${_proto_path}
+ ${CMAKE_CURRENT_BINARY_DIR}/protos
+ EXCLUDE_FROM_ALL
+)
-include_directories(
- ./src
- ./src/client-base-reactors
- ./src/server-base-reactors
- ./src/grpc-client
- ./src/DatabaseEntities
- ./src/Reactors
- ./src/Reactors/server
- ./src/Reactors/server/base-reactors
- ./src/Reactors/client
- ./src/Reactors/client/blob
- ./src/Reactors/client/base-reactors
- ./_generated
- ${FOLLY_INCLUDES}
- ./lib/double-conversion
- ${Boost_INCLUDE_DIR}
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../lib/src
+ ${CMAKE_CURRENT_BINARY_DIR}/lib/src
+ EXCLUDE_FROM_ALL
)
+file(GLOB_RECURSE SOURCE_CODE "./src/*.cpp")
+
# SERVER
add_executable(
backup
${GENERATED_CODE}
- ${DOUBLE_CONVERSION_SOURCES}
${FOLLY_SOURCES}
${SOURCE_CODE}
)
+target_include_directories(
+ backup
+ PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/grpc-client
+ ${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
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/Reactors/client
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/Reactors/client/blob
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/Reactors/client/base-reactors
+
+ ${Boost_INCLUDE_DIR}
+)
+
set(
LIBS
@@ -65,6 +77,14 @@
${AWSSDK_LINK_LIBRARIES}
${Boost_LIBRARIES}
glog::glog
+ Folly::folly
+ gRPC::grpc++
+
+ comm-blob-grpc
+ comm-backup-grpc
+ comm-services-common
+ comm-client-base-reactors
+ comm-server-base-reactors
)
target_link_libraries(
@@ -94,7 +114,6 @@
runTests
${GENERATED_CODE}
- ${DOUBLE_CONVERSION_SOURCES}
${FOLLY_SOURCES}
${SOURCE_CODE}
${TEST_CODE}
diff --git a/services/backup/Dockerfile b/services/backup/Dockerfile
--- a/services/backup/Dockerfile
+++ b/services/backup/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/backup.proto native/cpp/CommonCpp/grpc/protos/blob.proto protos/
-COPY services/lib/cmake-components cmake-components
+COPY services/backup/ backup/
+COPY services/lib/src/ lib/src/
+
+WORKDIR /transferred/backup
+
+COPY native/cpp/CommonCpp/grpc grpc/
COPY services/lib/docker/ scripts/
-COPY services/backup/ .
-COPY services/lib/src/* src/
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/backup/src/BackupServiceImpl.h b/services/backup/src/BackupServiceImpl.h
--- a/services/backup/src/BackupServiceImpl.h
+++ b/services/backup/src/BackupServiceImpl.h
@@ -1,7 +1,7 @@
#pragma once
-#include "../_generated/backup.grpc.pb.h"
-#include "../_generated/backup.pb.h"
+#include <backup.grpc.pb.h>
+#include <backup.pb.h>
#include <grpcpp/grpcpp.h>
diff --git a/services/backup/src/DatabaseEntities/DatabaseEntitiesTools.h b/services/backup/src/DatabaseEntities/DatabaseEntitiesTools.h
deleted file mode 100644
--- a/services/backup/src/DatabaseEntities/DatabaseEntitiesTools.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#pragma once
-
-#include "Item.h"
-
-#include "BackupItem.h"
-#include "LogItem.h"
-
-#include <memory>
-#include <type_traits>
-
-namespace comm {
-namespace network {
-namespace database {
-
-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/backup/src/DatabaseManager.h b/services/backup/src/DatabaseManager.h
--- a/services/backup/src/DatabaseManager.h
+++ b/services/backup/src/DatabaseManager.h
@@ -1,8 +1,10 @@
#pragma once
+#include "BackupItem.h"
#include "DatabaseEntitiesTools.h"
#include "DatabaseManagerBase.h"
#include "DynamoDBTools.h"
+#include "LogItem.h"
#include <aws/core/Aws.h>
#include <aws/dynamodb/model/AttributeDefinition.h>
diff --git a/services/backup/src/Reactors/client/blob/BlobGetClientReactor.h b/services/backup/src/Reactors/client/blob/BlobGetClientReactor.h
--- a/services/backup/src/Reactors/client/blob/BlobGetClientReactor.h
+++ b/services/backup/src/Reactors/client/blob/BlobGetClientReactor.h
@@ -1,9 +1,9 @@
#pragma once
-#include "../_generated/blob.grpc.pb.h"
-#include "../_generated/blob.pb.h"
+#include <blob.grpc.pb.h>
+#include <blob.pb.h>
-#include "ClientReadReactorBase.h"
+#include <ClientReadReactorBase.h>
#include <folly/MPMCQueue.h>
#include <grpcpp/grpcpp.h>
diff --git a/services/backup/src/Reactors/server/PullBackupReactor.h b/services/backup/src/Reactors/server/PullBackupReactor.h
--- a/services/backup/src/Reactors/server/PullBackupReactor.h
+++ b/services/backup/src/Reactors/server/PullBackupReactor.h
@@ -1,11 +1,13 @@
#pragma once
+#include "BackupItem.h"
#include "BlobGetClientReactor.h"
#include "DatabaseEntitiesTools.h"
+#include "LogItem.h"
#include "ServiceBlobClient.h"
-#include "../_generated/backup.grpc.pb.h"
-#include "../_generated/backup.pb.h"
+#include <backup.grpc.pb.h>
+#include <backup.pb.h>
#include "ServerWriteReactorBase.h"
diff --git a/services/backup/src/grpc-client/ServiceBlobClient.h b/services/backup/src/grpc-client/ServiceBlobClient.h
--- a/services/backup/src/grpc-client/ServiceBlobClient.h
+++ b/services/backup/src/grpc-client/ServiceBlobClient.h
@@ -3,8 +3,8 @@
#include "BlobGetClientReactor.h"
#include "BlobPutClientReactor.h"
-#include "../_generated/blob.grpc.pb.h"
-#include "../_generated/blob.pb.h"
+#include <blob.grpc.pb.h>
+#include <blob.pb.h>
#include <grpcpp/grpcpp.h>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 11:09 AM (18 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2570310
Default Alt Text
D4494.id15175.diff (6 KB)
Attached To
Mode
D4494: [Services] Update backup CMake
Attached
Detach File
Event Timeline
Log In to Comment