Skip to content

Commit

Permalink
Merge pull request #29 from Seagate/features/asokvad-103-4
Browse files Browse the repository at this point in the history
Bumped client version and updated copydrive for pipeline
  • Loading branch information
alamottemitchell committed Jul 4, 2014
2 parents acb94b3 + 936e865 commit 01803da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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 ""
)
Expand Down
19 changes: 13 additions & 6 deletions src/copydrive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
*/

#include <stdio.h>
#include <stdlib.h>
#include <memory>
#include <vector>

#include "kinetic/kinetic.h"

Expand All @@ -37,15 +40,18 @@ using std::make_pair;

kinetic::P2PPushRequest prepare_request(const vector<kinetic::P2PPushOperation>& operations, const vector<pair<string, int>>& 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;
}

Expand All @@ -55,8 +61,9 @@ void dispatch_request(shared_ptr<kinetic::BlockingKineticConnection> connection,
kinetic::P2PPushRequest request = prepare_request(operations, destinations, 0);

unique_ptr<vector<kinetic::KineticStatus>> statuses(new vector<kinetic::KineticStatus>());
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);
}

Expand Down Expand Up @@ -100,7 +107,7 @@ int main(int argc, char* argv[]) {
kinetic::KineticConnectionFactory kinetic_connection_factory = kinetic::NewKineticConnectionFactory();

shared_ptr<kinetic::BlockingKineticConnection> 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;
}
Expand Down

0 comments on commit 01803da

Please sign in to comment.