Commit 5edd8048 authored by Greg Williams's avatar Greg Williams
Browse files

Added closure parameters to public API operation methods to support async IO.

Need to fix KineticEntry buffer copying issues.
Need to fix client tests.
parent 7eca5297
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -150,8 +150,8 @@ namespace :java_sim do
    ENV['CLASSPATH'] = '' unless ENV['CLASSPATH']
    jars += [File.join(JAVA_HOME, 'lib/tools.jar')]
    jars.each {|jar| ENV['CLASSPATH'] += ':' + jar }
    $java_sim = spawn("#{JAVA_BIN} -classpath #{ENV['CLASSPATH']} com.seagate.kinetic.simulator.internal.SimulatorRunner")
    sleep 5 # wait for simulator to start up and server ready to receive connections
    $java_sim = spawn("#{JAVA_BIN} -classpath #{ENV['CLASSPATH']} com.seagate.kinetic.simulator.internal.SimulatorRunner") # &> ./build/kinetic-simulator-test.log")
    sleep 3 # wait for simulator to start up and server ready to receive connections
    # TODO: use netstat or something to just wait until the server opens the port
    #       since it might take longer than the hardcoded sleep(x) above :-/
  end
@@ -169,7 +169,7 @@ namespace :java_sim do

  def java_sim_erase_drive
    java_sim_start
    sh "\"#{JAVA_BIN}\" -classpath \"#{ENV['CLASSPATH']}\" com.seagate.kinetic.admin.cli.KineticAdminCLI -instanterase"
    sh "\"#{JAVA_BIN}\" -classpath \"#{ENV['CLASSPATH']}\" com.seagate.kinetic.admin.cli.KineticAdminCLI -instanterase" # &> ./build/kinetic-simulator-setup.log"
  end

  def java_sim_cleanup
+8 −1
Original line number Diff line number Diff line
@@ -89,7 +89,11 @@
      - -Wall
      - -Wextra
      - -Wstrict-prototypes
      - -Wcast-align
      - -Wincompatible-pointer-types
      - -Werror=incompatible-pointer-types
      - -Werror=strict-prototypes
      - -Werror=implicit-function-declaration
      # - -Wcast-align
      - -pedantic
      - -D_POSIX_C_SOURCE=1
      - -D_C99_SOURCE=1
@@ -108,6 +112,9 @@
      # - -pedantic
      - -Wstrict-prototypes
      # - -Wcast-align
      - -Werror=strict-prototypes
      - -Werror=implicit-function-declaration
      - -Werror=incompatible-pointer-types
      - -D_POSIX_C_SOURCE=1
      - -D_C99_SOURCE=1
      - -Wno-nonnull
+5 −0
Original line number Diff line number Diff line
@@ -36,6 +36,11 @@ typedef struct {
    size_t bytesUsed; /**< Reflects the number of bytes used from the `array` */
} ByteBuffer;

typedef struct {
    ByteBuffer* buffers;
    int count;
} ByteBufferArray;

/** @brief Convenience macro to represent an empty buffer with no data */
#define BYTE_BUFFER_NONE (ByteBuffer){.array = BYTE_ARRAY_NONE, .bytesUsed = 0}

+10 −10
Original line number Diff line number Diff line
@@ -82,7 +82,8 @@ KineticStatus KineticClient_NoOp(KineticSessionHandle handle);
 * @return              Returns the resulting KineticStatus
 */
KineticStatus KineticClient_Put(KineticSessionHandle handle,
                                KineticEntry* const metadata);
                                KineticEntry* const metadata,
                                KineticCompletionClosure* closure);

/**
 * @brief Executes a GET command to retrieve and entry from the Kinetic Device.
@@ -94,7 +95,8 @@ KineticStatus KineticClient_Put(KineticSessionHandle handle,
 * @return              Returns the resulting KineticStatus
 */
KineticStatus KineticClient_Get(KineticSessionHandle handle,
                                KineticEntry* const metadata);
                                KineticEntry* const metadata,
                                KineticCompletionClosure* closure);

/**
 * @brief Executes a DELETE command to delete an entry from the Kinetic Device
@@ -106,25 +108,23 @@ KineticStatus KineticClient_Get(KineticSessionHandle handle,
 * @return              Returns the resulting KineticStatus
 */
KineticStatus KineticClient_Delete(KineticSessionHandle handle,
                                   KineticEntry* const metadata);
                                   KineticEntry* const metadata,
                                   KineticCompletionClosure* closure);

/**
 * @brief Executes a GETKEYRANGE command to retrive a set of keys in the range
 * specified range from the Kinetic Device
 *
 * @param handle        KineticSessionHandle for a connected session.
 * @param handle        KineticSessionHandle for a connected session
 * @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.
 * @param keys          ByteBufferArray to store the retrieved keys
 *
 *
 * @return              Returns 0 upon succes, -1 or the Kinetic status code
 *                      upon failure
 */
KineticStatus KineticClient_GetKeyRange(KineticSessionHandle handle,
                                        KineticKeyRange* range, ByteBuffer keys[], int max_keys);
                                        KineticKeyRange* range, ByteBufferArray keys,
                                        KineticCompletionClosure* closure);

#endif // _KINETIC_CLIENT_H
+4 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@
#include <stdio.h>
#include <assert.h>
#include <limits.h>
#include <sys/time.h>
#include "byte_array.h"


@@ -158,6 +159,9 @@ typedef enum {
const char* Kinetic_GetStatusDescription(KineticStatus status);

typedef struct _KineticCompletionData {
    int64_t connectionID;
    int64_t sequence;
    struct timeval requestTime;
    KineticStatus status;
} KineticCompletionData;

Loading