Commit ec86144a authored by Greg Williams's avatar Greg Williams
Browse files

Added kinetic_serial_allocator to support dynamic allocation of device info...

Added kinetic_serial_allocator to support dynamic allocation of device info reported from GetLog operations. Still need to complete filling out device info allocation and population of public client info structure.
parent 83c183b8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ all: clean test default run

clean:
	bundle exec rake clobber
	rm -rf $(BIN_DIR)/* $(OUT_DIR)/*.o *.core
	rm -rf $(BIN_DIR)/* $(OUT_DIR)/*.o *.core *.log
	git submodule update --init

.PHONY: clean
+1 −1
Original line number Diff line number Diff line
---

:project:
  :use_exceptions: true
  :use_exceptions: false
  :use_test_preprocessor: true
  :use_deep_dependencies: true
  :build_root: build
+5 −2
Original line number Diff line number Diff line
@@ -146,16 +146,19 @@ KineticStatus KineticClient_GetKeyRange(KineticSessionHandle handle,
 *
 * @param handle        KineticSessionHandle for a connected session
 * @param type          KineticLogDataType specifying data type to retrieve.
 * @param info          KineticDeviceInfo pointer, which will be assigned to
 *                      a dynamically allocated structure populated with
 *                      the requested data, if successful.
 * @param closure       Optional closure. If specified, operation will be
 *                      executed in asynchronous mode, and closure callback
 *                      will be called upon completion.
 *
 *
 * @return              Returns 0 upon succes, -1 or the Kinetic status code
 *                      upon failure
 */
KineticStatus KineticClient_GetLog(KineticSessionHandle handle,
                                   KineticLogDataType type,
                                   KineticDeviceInfo_Type type,
                                   KineticDeviceInfo** info,
                                   KineticCompletionClosure* closure);

#endif // _KINETIC_CLIENT_H
+98 −9
Original line number Diff line number Diff line
@@ -204,14 +204,103 @@ typedef struct _KineticKeyRange {

// Kinetic GetLog data types
typedef enum {
    KINETIC_LOG_DATA_TYPE_UTILIZATIONS = 0,
    KINETIC_LOG_DATA_TYPE_TEMPERATURES,
    KINETIC_LOG_DATA_TYPE_CAPACITIES,
    KINETIC_LOG_DATA_TYPE_CONFIGURATION,
    KINETIC_LOG_DATA_TYPE_STATISTICS,
    KINETIC_LOG_DATA_TYPE_MESSAGES,
    KINETIC_LOG_DATA_TYPE_LIMITS,
    KINETIC_LOG_DATA_TYPE_DEVICE,
} KineticLogDataType;
    KINETIC_DEVICE_INFO_TYPE_UTILIZATIONS = 0,
    KINETIC_DEVICE_INFO_TYPE_TEMPERATURES,
    KINETIC_DEVICE_INFO_TYPE_CAPACITIES,
    KINETIC_DEVICE_INFO_TYPE_CONFIGURATION,
    KINETIC_DEVICE_INFO_TYPE_STATISTICS,
    KINETIC_DEVICE_INFO_TYPE_MESSAGES,
    KINETIC_DEVICE_INFO_TYPE_LIMITS,
    KINETIC_DEVICE_INFO_TYPE_DEVICE,
} KineticDeviceInfo_Type;
typedef struct {
    char* name;
    float value;
} KineticDeviceInfo_Utilization;
typedef struct {
    char* name;
    float current;
    float minimum;
    float maximum;
    float target;
} KineticDeviceInfo_Temperature;
typedef struct {
    uint64_t nominalCapacityInBytes;
    float portionFull;
} KineticDeviceInfo_Capacity;
typedef struct {
    char* name;
    ByteArray MAC;
    ByteArray ipv4Address;
    ByteArray ipv6Address;
} KineticDeviceInfo_Interface;
typedef struct {
    char* vendor;
    char* model;
    ByteArray serialNumber;
    ByteArray worldWideName;
    char* version;
    char* compilationDate;
    char* sourceHash;
    char* protocolVersion;
    char* protocolCompilationDate;
    char* protocolSourceHash;
    KineticDeviceInfo_Interface** interfaces;
    size_t numInterfaces;
    int32_t port;
    int32_t tlsPort;
} KineticDeviceInfo_Configuration;
typedef enum {
    KINETIC_MESSAGE_TYPE_GET = 0,
    KINETIC_MESSAGE_TYPE_PUT,
    KINETIC_MESSAGE_TYPE_DELETE,
    KINETIC_MESSAGE_TYPE_GETNEXT,
    KINETIC_MESSAGE_TYPE_GETPREVIOUS,
    KINETIC_MESSAGE_TYPE_GETKEYRANGE,
    KINETIC_MESSAGE_TYPE_GETVERSION,
    KINETIC_MESSAGE_TYPE_SETUP,
    KINETIC_MESSAGE_TYPE_GETLOG,
    KINETIC_MESSAGE_TYPE_SECURITY,
    KINETIC_MESSAGE_TYPE_PEER2PEERPUSH,
    KINETIC_MESSAGE_TYPE_NOOP,
    KINETIC_MESSAGE_TYPE_FLUSHALLDATA,
    KINETIC_MESSAGE_TYPE_PINOP,
    KINETIC_MESSAGE_TYPE_MEDIASCAN,
    KINETIC_MESSAGE_TYPE_MEDIAOPTIMIZE,
} KineticMessageType;
typedef struct {
    KineticMessageType messageType;
    uint64_t count;
    uint64_t bytes;
} KineticDeviceInfo_Statistics;
typedef struct {
    uint32_t maxKeySize;
    uint32_t maxValueSize;
    uint32_t maxVersionSize;
    uint32_t maxTagSize;
    uint32_t maxConnections;
    uint32_t maxOutstandingReadRequests;
    uint32_t maxOutstandingWriteRequests;
    uint32_t maxMessageSize;
    uint32_t maxKeyRangeCount;
    uint32_t maxIdentityCount;
    uint32_t maxPinSize;
} KineticDeviceInfo_Limits;
typedef struct {
    ByteArray name;
} KineticDeviceInfo_Device;
typedef struct {
    KineticDeviceInfo_Utilization** utilizations;
    size_t numUtilizations;
    KineticDeviceInfo_Temperature** temperatures;
    size_t numTemperatures;
    KineticDeviceInfo_Capacity* capacity;
    KineticDeviceInfo_Configuration* configuration;
    KineticDeviceInfo_Statistics** statistics;
    size_t numStatistics;
    ByteArray messages;
    KineticDeviceInfo_Limits* limits;
    KineticDeviceInfo_Device* device;
} KineticDeviceInfo;

#endif // _KINETIC_TYPES_H
+5 −2
Original line number Diff line number Diff line
@@ -198,16 +198,19 @@ KineticStatus KineticClient_GetKeyRange(KineticSessionHandle handle,
}

KineticStatus KineticClient_GetLog(KineticSessionHandle handle,
                                   KineticLogDataType type,
                                   KineticDeviceInfo_Type type,
                                   KineticDeviceInfo** info,
                                   KineticCompletionClosure* closure)
{
    assert(handle != KINETIC_HANDLE_INVALID);
    assert(info != NULL);
    // assert(*info != NULL);

    KineticOperation* operation = KineticController_CreateOperation(handle);
    if (operation == NULL) {return KINETIC_STATUS_MEMORY_ERROR;}

    // Initialize request
    KineticOperation_BuildGetLog(operation, type);
    KineticOperation_BuildGetLog(operation, type, info);
    if (closure != NULL) {operation->closure = *closure;}

    // Execute the operation
Loading