Loading CMakeLists.txt +2 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ else(USE_LOCAL_KINETIC_CLIENT) kinetic_cpp_client PREFIX "vendor" GIT_REPOSITORY "git@github.com:Seagate/Kinetic-C-Client.git" GIT_TAG "1891260a90bc7ec8451a09efc10a346a4c41ec9c" GIT_TAG "f774a6e15a19df10d5593f763d64fe6b6f27383a" BUILD_IN_SOURCE 1 INSTALL_COMMAND "" ) Loading Loading @@ -70,3 +70,4 @@ add_example_target(delete_file_blocking) add_example_target(write_file_nonblocking) add_example_target(firmware_update) add_example_target(write_file_blocking_threads) add_example_target(dump_keyspace) src/dump_keyspace.cc 0 → 100644 +51 −0 Original line number Diff line number Diff line // This shows how to iterate over the keyspace #include <stdio.h> #include "kinetic/kinetic.h" using kinetic::KineticConnectionFactory; using kinetic::Status; using kinetic::KineticRecord; using std::shared_ptr; using std::string; using std::unique_ptr; int main(int argc, char* argv[]) { if (argc != 3) { printf("%s: <host> <port>\n", argv[0]); return 1; } const char* host = argv[1]; int port = atoi(argv[2]); kinetic::ConnectionOptions options; options.host = host; options.port = port; options.user_id = 1; options.hmac_key = "asdfasdf"; kinetic::KineticConnectionFactory kinetic_connection_factory = kinetic::NewKineticConnectionFactory(); unique_ptr<kinetic::ConnectionHandle> connection; if (!kinetic_connection_factory.NewConnection(options, connection).ok()) { printf("Unable to connect\n"); return 1; } // Build a key consisting of "FFFFFF...". In almost all cases this will come after the last // key in the drive string last_key; for (int i = 0; i < 800*1024; i++) { last_key += "\xFF"; } // Iterate over all the keys and print them out for (kinetic::KeyRangeIterator it = connection->blocking().IterateKeyRange("", true, last_key, true, 100); it != kinetic::KeyRangeEnd(); ++it) { printf("%s\n", it->c_str()); } return 0; } Loading
CMakeLists.txt +2 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ else(USE_LOCAL_KINETIC_CLIENT) kinetic_cpp_client PREFIX "vendor" GIT_REPOSITORY "git@github.com:Seagate/Kinetic-C-Client.git" GIT_TAG "1891260a90bc7ec8451a09efc10a346a4c41ec9c" GIT_TAG "f774a6e15a19df10d5593f763d64fe6b6f27383a" BUILD_IN_SOURCE 1 INSTALL_COMMAND "" ) Loading Loading @@ -70,3 +70,4 @@ add_example_target(delete_file_blocking) add_example_target(write_file_nonblocking) add_example_target(firmware_update) add_example_target(write_file_blocking_threads) add_example_target(dump_keyspace)
src/dump_keyspace.cc 0 → 100644 +51 −0 Original line number Diff line number Diff line // This shows how to iterate over the keyspace #include <stdio.h> #include "kinetic/kinetic.h" using kinetic::KineticConnectionFactory; using kinetic::Status; using kinetic::KineticRecord; using std::shared_ptr; using std::string; using std::unique_ptr; int main(int argc, char* argv[]) { if (argc != 3) { printf("%s: <host> <port>\n", argv[0]); return 1; } const char* host = argv[1]; int port = atoi(argv[2]); kinetic::ConnectionOptions options; options.host = host; options.port = port; options.user_id = 1; options.hmac_key = "asdfasdf"; kinetic::KineticConnectionFactory kinetic_connection_factory = kinetic::NewKineticConnectionFactory(); unique_ptr<kinetic::ConnectionHandle> connection; if (!kinetic_connection_factory.NewConnection(options, connection).ok()) { printf("Unable to connect\n"); return 1; } // Build a key consisting of "FFFFFF...". In almost all cases this will come after the last // key in the drive string last_key; for (int i = 0; i < 800*1024; i++) { last_key += "\xFF"; } // Iterate over all the keys and print them out for (kinetic::KeyRangeIterator it = connection->blocking().IterateKeyRange("", true, last_key, true, 100); it != kinetic::KeyRangeEnd(); ++it) { printf("%s\n", it->c_str()); } return 0; }