Loading include/kinetic_client.h +19 −0 Original line number Diff line number Diff line Loading @@ -121,4 +121,23 @@ KineticStatus KineticClient_Get(KineticOperation* operation, KineticStatus KineticClient_Delete(KineticOperation* operation, KineticKeyValue* metadata); /** * @brief Executes a GETKEYRANGE command to retrive a set of keys in the range * specified range from the Kinetic Device * * @param operation KineticOperation instance to use for the operation * @param range KineticKeyRange specifying keys to return * @param keys An pointer to an array of ByteBuffers with pre-allocated * arrays to store the retrieved keys * @param max_keys The number maximum number of keys to request from the * device. There must be at least this many ByteBuffers in * the `keys` array for population. * * * @return Returns 0 upon succes, -1 or the Kinetic status code * upon failure */ KineticStatus KineticClient_GetKeyRange(KineticOperation* operation, KineticKeyRange* range, ByteBuffer* keys[], int max_keys); #endif // _KINETIC_CLIENT_H include/kinetic_types.h +11 −0 Original line number Diff line number Diff line Loading @@ -317,5 +317,16 @@ typedef struct _KineticOperation .response = (_resp), \ } // Kinetic Key Range request structure typedef struct _KineticKeyRange { ByteBuffer startKey; ByteBuffer endKey; bool startKeyInclusive; bool endKeyInclusive; int32_t maxReturned; bool reverse; } KineticKeyRange; #endif // _KINETIC_TYPES_H project.yml +19 −15 Original line number Diff line number Diff line Loading @@ -107,6 +107,7 @@ - -Wextra - -pedantic - -D_POSIX_C_SOURCE=1 - -D_C99_SOURCE=1 - ${1} :test_compiler: :executable: gcc Loading @@ -121,23 +122,9 @@ - -Wextra - -pedantic - -D_POSIX_C_SOURCE=1 - -D_C99_SOURCE=1 - -c ${1} - -o ${2} :test_linker: :executable: gcc :name: test_linker :arguments: - "\"${1}\"" - -l crypto - "-o \"${2}\"" :gcov_linker: :executable: gcc :arguments: - -fprofile-arcs - -ftest-coverage - -l crypto - ${1} - -o ${2} :release_compiler: :executable: gcc :arguments: Loading @@ -151,10 +138,27 @@ - -Wextra - -pedantic - -D_POSIX_C_SOURCE=1 - -D_C99_SOURCE=1 - -l crypto - -l ssl - "-c \"${1}\"" - "-o \"${2}\"" :test_linker: :executable: gcc :name: test_linker :arguments: - "\"${1}\"" - -l crypto - "-o \"${2}\"" :gcov_linker: :executable: gcc :arguments: - -fprofile-arcs - -ftest-coverage - -l crypto - ${1} - -o ${2} :release_linker: :executable: gcc :name: release_linker Loading src/lib/kinetic_client.c +69 −18 Original line number Diff line number Diff line Loading @@ -28,7 +28,28 @@ #include "kinetic_logger.h" #include <stdio.h> KineticStatus KineticClient_ExecuteOperation(KineticOperation* operation); KineticStatus KineticClient_ExecuteOperation(KineticOperation* operation) { KineticStatus status = KINETIC_STATUS_INVALID; // Send the request if (KineticPDU_Send(operation->request)) { // Associate response with same exchange as request operation->response->connection = operation->request->connection; // Receive the response if (KineticPDU_Receive(operation->response)) { status = KineticOperation_GetStatus(operation); } } return status; } void KineticClient_Init(const char* logFile) { Loading Loading @@ -216,23 +237,53 @@ KineticStatus KineticClient_Delete(KineticOperation* operation, return status; } KineticStatus KineticClient_ExecuteOperation(KineticOperation* operation) { KineticStatus status = KINETIC_STATUS_INVALID; // Send the request if (KineticPDU_Send(operation->request)) // command { // header { // // See above for descriptions of these fields // clusterVersion: ... // identity: ... // connectionID: ... // sequence: ... // // messageType should be GETKEYRANGE // messageType: GETKEYRANGE // } // body { // // The range message must be populated // range { // // Required bytes, the beginning of the requested range // startKey: "..." // // Optional bool, defaults to false // // True indicates that the start key should be included in the returned // // range // startKeyInclusive: ... // // Required bytes, the end of the requested range // endKey: "..." // // Optional bool, defaults to false // // True indicates that the end key should be included in the returned // // range // endKeyInclusive: ... // // Required int32, must be greater than 0 // // The maximum number of keys returned, in sorted order // maxReturned: ... // // Optional bool, defaults to false // // If true, the key range will be returned in reverse order, starting at // // endKey and moving back to startKey. For instance // // if the search is startKey="j", endKey="k", maxReturned=2, // // reverse=true and the keys "k0", "k1", "k2" exist // // the system will return "k2" and "k1" in that order. // reverse: .... // } // } // } KineticStatus KineticClient_GetKeyRange(KineticOperation* operation, KineticKeyRange* range, ByteBuffer* keys[], int max_keys) { // Associate response with same exchange as request operation->response->connection = operation->request->connection; // Receive the response if (KineticPDU_Receive(operation->response)) { status = KineticOperation_GetStatus(operation); } } KineticStatus status = KINETIC_STATUS_SUCCESS; return status; } src/lib/kinetic_socket.c +0 −1 Original line number Diff line number Diff line Loading @@ -104,7 +104,6 @@ int KineticSocket_Connect(char* host, int port, bool nonBlocking) for (ai = ai_result; ai != NULL; ai = ai->ai_next) { int setsockopt_result; int enable = 1; int buffer_size = PDU_VALUE_MAX_LEN; #if defined(SO_NOSIGPIPE) && !defined(__APPLE__) Loading Loading
include/kinetic_client.h +19 −0 Original line number Diff line number Diff line Loading @@ -121,4 +121,23 @@ KineticStatus KineticClient_Get(KineticOperation* operation, KineticStatus KineticClient_Delete(KineticOperation* operation, KineticKeyValue* metadata); /** * @brief Executes a GETKEYRANGE command to retrive a set of keys in the range * specified range from the Kinetic Device * * @param operation KineticOperation instance to use for the operation * @param range KineticKeyRange specifying keys to return * @param keys An pointer to an array of ByteBuffers with pre-allocated * arrays to store the retrieved keys * @param max_keys The number maximum number of keys to request from the * device. There must be at least this many ByteBuffers in * the `keys` array for population. * * * @return Returns 0 upon succes, -1 or the Kinetic status code * upon failure */ KineticStatus KineticClient_GetKeyRange(KineticOperation* operation, KineticKeyRange* range, ByteBuffer* keys[], int max_keys); #endif // _KINETIC_CLIENT_H
include/kinetic_types.h +11 −0 Original line number Diff line number Diff line Loading @@ -317,5 +317,16 @@ typedef struct _KineticOperation .response = (_resp), \ } // Kinetic Key Range request structure typedef struct _KineticKeyRange { ByteBuffer startKey; ByteBuffer endKey; bool startKeyInclusive; bool endKeyInclusive; int32_t maxReturned; bool reverse; } KineticKeyRange; #endif // _KINETIC_TYPES_H
project.yml +19 −15 Original line number Diff line number Diff line Loading @@ -107,6 +107,7 @@ - -Wextra - -pedantic - -D_POSIX_C_SOURCE=1 - -D_C99_SOURCE=1 - ${1} :test_compiler: :executable: gcc Loading @@ -121,23 +122,9 @@ - -Wextra - -pedantic - -D_POSIX_C_SOURCE=1 - -D_C99_SOURCE=1 - -c ${1} - -o ${2} :test_linker: :executable: gcc :name: test_linker :arguments: - "\"${1}\"" - -l crypto - "-o \"${2}\"" :gcov_linker: :executable: gcc :arguments: - -fprofile-arcs - -ftest-coverage - -l crypto - ${1} - -o ${2} :release_compiler: :executable: gcc :arguments: Loading @@ -151,10 +138,27 @@ - -Wextra - -pedantic - -D_POSIX_C_SOURCE=1 - -D_C99_SOURCE=1 - -l crypto - -l ssl - "-c \"${1}\"" - "-o \"${2}\"" :test_linker: :executable: gcc :name: test_linker :arguments: - "\"${1}\"" - -l crypto - "-o \"${2}\"" :gcov_linker: :executable: gcc :arguments: - -fprofile-arcs - -ftest-coverage - -l crypto - ${1} - -o ${2} :release_linker: :executable: gcc :name: release_linker Loading
src/lib/kinetic_client.c +69 −18 Original line number Diff line number Diff line Loading @@ -28,7 +28,28 @@ #include "kinetic_logger.h" #include <stdio.h> KineticStatus KineticClient_ExecuteOperation(KineticOperation* operation); KineticStatus KineticClient_ExecuteOperation(KineticOperation* operation) { KineticStatus status = KINETIC_STATUS_INVALID; // Send the request if (KineticPDU_Send(operation->request)) { // Associate response with same exchange as request operation->response->connection = operation->request->connection; // Receive the response if (KineticPDU_Receive(operation->response)) { status = KineticOperation_GetStatus(operation); } } return status; } void KineticClient_Init(const char* logFile) { Loading Loading @@ -216,23 +237,53 @@ KineticStatus KineticClient_Delete(KineticOperation* operation, return status; } KineticStatus KineticClient_ExecuteOperation(KineticOperation* operation) { KineticStatus status = KINETIC_STATUS_INVALID; // Send the request if (KineticPDU_Send(operation->request)) // command { // header { // // See above for descriptions of these fields // clusterVersion: ... // identity: ... // connectionID: ... // sequence: ... // // messageType should be GETKEYRANGE // messageType: GETKEYRANGE // } // body { // // The range message must be populated // range { // // Required bytes, the beginning of the requested range // startKey: "..." // // Optional bool, defaults to false // // True indicates that the start key should be included in the returned // // range // startKeyInclusive: ... // // Required bytes, the end of the requested range // endKey: "..." // // Optional bool, defaults to false // // True indicates that the end key should be included in the returned // // range // endKeyInclusive: ... // // Required int32, must be greater than 0 // // The maximum number of keys returned, in sorted order // maxReturned: ... // // Optional bool, defaults to false // // If true, the key range will be returned in reverse order, starting at // // endKey and moving back to startKey. For instance // // if the search is startKey="j", endKey="k", maxReturned=2, // // reverse=true and the keys "k0", "k1", "k2" exist // // the system will return "k2" and "k1" in that order. // reverse: .... // } // } // } KineticStatus KineticClient_GetKeyRange(KineticOperation* operation, KineticKeyRange* range, ByteBuffer* keys[], int max_keys) { // Associate response with same exchange as request operation->response->connection = operation->request->connection; // Receive the response if (KineticPDU_Receive(operation->response)) { status = KineticOperation_GetStatus(operation); } } KineticStatus status = KINETIC_STATUS_SUCCESS; return status; }
src/lib/kinetic_socket.c +0 −1 Original line number Diff line number Diff line Loading @@ -104,7 +104,6 @@ int KineticSocket_Connect(char* host, int port, bool nonBlocking) for (ai = ai_result; ai != NULL; ai = ai->ai_next) { int setsockopt_result; int enable = 1; int buffer_size = PDU_VALUE_MAX_LEN; #if defined(SO_NOSIGPIPE) && !defined(__APPLE__) Loading