diff --git a/CMakeLists.txt b/CMakeLists.txt index e4b3010..a65b756 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ project(kinetic_cpp_client_examples CXX C) find_package (Threads) -set(CMAKE_CXX_FLAGS "--std=c++11 -Wall -Wextra -Werror -Wno-unknown-warning-option -Wno-unused-parameter -Wno-unused-local-typedefs -Wno-null-dereference -DGTEST_USE_OWN_TR1_TUPLE=1 -D__STDC_FORMAT_MACROS") +set(CMAKE_CXX_FLAGS "-g --std=c++11 -Wall -Wextra -Werror -Wno-unknown-warning-option -Wno-unused-parameter -Wno-unused-local-typedefs -Wno-null-dereference -DGTEST_USE_OWN_TR1_TUPLE=1 -D__STDC_FORMAT_MACROS") set(GENERATED_SOURCES_PATH ${kinetic_cpp_client_SOURCE_DIR}/src/main/generated) @@ -18,7 +18,7 @@ else(USE_LOCAL_KINETIC_CLIENT) kinetic_cpp_client PREFIX "vendor" GIT_REPOSITORY "https://github.com/Seagate/kinetic-cpp-client.git" - GIT_TAG "29ab1eafa95daca535b7eb23cd5253dbdef31f4c" + GIT_TAG "0.0.9" BUILD_IN_SOURCE 1 INSTALL_COMMAND "" ) diff --git a/src/copydrive.cc b/src/copydrive.cc index e823977..2c3bb30 100644 --- a/src/copydrive.cc +++ b/src/copydrive.cc @@ -19,6 +19,9 @@ */ #include +#include +#include +#include #include "kinetic/kinetic.h" @@ -37,15 +40,18 @@ using std::make_pair; kinetic::P2PPushRequest prepare_request(const vector& operations, const vector>& destinations, size_t currentDestination) { kinetic::P2PPushRequest request; - if (currentDestination < destinations.size() - 1) { - request.requests.push_back(prepare_request(operations, destinations, currentDestination + 1)); - } request.host = destinations[currentDestination].first; request.port = destinations[currentDestination].second; request.operations = operations; + if (currentDestination < destinations.size() - 1) { + // Add the pipleline request onto this request's first operation + request.operations[0].request = make_shared<::kinetic::P2PPushRequest>( + prepare_request(operations, destinations, currentDestination + 1)); + } + return request; } @@ -55,8 +61,9 @@ void dispatch_request(shared_ptr connection, kinetic::P2PPushRequest request = prepare_request(operations, destinations, 0); unique_ptr> statuses(new vector()); - if (!connection->P2PPush(request, statuses).ok()) { - printf("Error pushing\n"); + auto status = connection->P2PPush(request, statuses); + if (!status.ok()) { + printf("Error pushing: %d, %s\n", status.statusCode(), status.message().c_str()); exit(1); } @@ -100,7 +107,7 @@ int main(int argc, char* argv[]) { kinetic::KineticConnectionFactory kinetic_connection_factory = kinetic::NewKineticConnectionFactory(); shared_ptr blocking_connection; - if(!kinetic_connection_factory.NewBlockingConnection(options, blocking_connection, 5).ok()){ + if(!kinetic_connection_factory.NewBlockingConnection(options, blocking_connection, 20).ok()){ printf("Unable to connect\n"); return 1; }