Commit 08a0a289 authored by Greg Williams's avatar Greg Williams
Browse files

In process of fixing system test validations

parent 259bbac0
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -175,14 +175,18 @@ typedef struct _KineticCompletionClosure {
// KineticEntry - byte arrays need to be preallocated by the client
typedef struct _KineticEntry {
    ByteBuffer key;
    ByteBuffer newVersion;
    ByteBuffer value;

    // Metadata
    ByteBuffer dbVersion;
    ByteBuffer tag;
    bool force;
    KineticAlgorithm algorithm;

    // Operation-specific attributes (TODO: remove from struct, and specify a attributes to PUT/GET operations)
    ByteBuffer newVersion;
    bool metadataOnly;
    bool force;
    KineticSynchronization synchronization;
    ByteBuffer value;
} KineticEntry;

// Kinetic Key Range request structure
+84 −0
Original line number Diff line number Diff line
/*
* kinetic-c
* Copyright (C) 2014 Seagate Technology.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/

#include "kinetic_entry.h"

// KineticEntry - byte arrays need to be preallocated by the client
// typedef struct _KineticEntry {
//     ByteBuffer key;
//     ByteBuffer value;

//     // Metadata
//     ByteBuffer dbVersion;
//     ByteBuffer tag;
//     KineticAlgorithm algorithm;

//     // Operation-specific attributes
//     // (TODO: remove from struct, and specify a attributes to PUT/GET operations)
//     ByteBuffer newVersion;
//     bool metadataOnly;
//     bool force;
//     KineticSynchronization synchronization;
// } KineticEntry;

void KineticEntry_Init(KineticEntry* entry)
{
    assert(entry != NULL);
    *entry = (KineticEntry) {
        .key = BYTE_BUFFER_NONE,
        .value = BYTE_BUFFER_NONE
    };
}

ByteBuffer* KineticEntry_GetVersion(KineticEntry* entry)
{
    assert(entry != NULL);
    return &entry->dbVersion;
}

void KineticEntry_SetVersion(KineticEntry* entry, ByteBuffer version)
{
    assert(entry != NULL);
    entry->dbVersion = version;
}

ByteBuffer* KineticEntry_GetTag(KineticEntry* entry)
{
    assert(entry != NULL);
    return &entry->tag;
}

void KineticEntry_SetTag(KineticEntry* entry, ByteBuffer tag)
{
    assert(entry != NULL);
    entry->tag = tag;
}

KineticAlgorithm KineticEntry_GetAlgorithm(KineticEntry* entry)
{
    assert(entry != NULL);
    return entry->algorithm;
}

void KineticEntry_SetAlgorithm(KineticEntry* entry, KineticAlgorithm algorithm)
{
    assert(entry != NULL);
    entry->algorithm = algorithm;
}
+34 −0
Original line number Diff line number Diff line
/*
* kinetic-c
* Copyright (C) 2014 Seagate Technology.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/

#ifndef _KINETIC_ENTRY_H
#define _KINETIC_ENTRY_H

#include "kinetic_types_internal.h"

void KineticEntry_Init(KineticEntry* entry);
ByteBuffer* KineticEntry_GetVersion(KineticEntry* entry);
void KineticEntry_SetVersion(KineticEntry* entry, ByteBuffer version);
ByteBuffer* KineticEntry_GetTag(KineticEntry* entry);
void KineticEntry_SetTag(KineticEntry* entry, ByteBuffer tag);
KineticAlgorithm KineticEntry_GetAlgorithm(KineticEntry* entry);
void KineticEntry_SetAlgorithm(KineticEntry* entry, KineticAlgorithm algorithm);

#endif // _KINETIC_ENTRY_H
+6 −7
Original line number Diff line number Diff line
@@ -215,7 +215,7 @@ KineticStatus KineticOperation_NoopCallback(KineticOperation* operation)
{
    assert(operation != NULL);
    assert(operation->connection != NULL);
    LOG_LOCATION; LOGF3("NOOP callback w/ operation (0x%0llX) on connection (0x%0llX)",
    LOGF3("NOOP callback w/ operation (0x%0llX) on connection (0x%0llX)",
        operation, operation->connection);
    return KINETIC_STATUS_SUCCESS;
}
@@ -238,7 +238,7 @@ KineticStatus KineticOperation_PutCallback(KineticOperation* operation)
{
    assert(operation != NULL);
    assert(operation->connection != NULL);
    LOG_LOCATION; LOGF3("PUT callback w/ operation (0x%0llX) on connection (0x%0llX)",
    LOGF3("PUT callback w/ operation (0x%0llX) on connection (0x%0llX)",
        operation, operation->connection);
    assert(operation->entryEnabled);

@@ -284,7 +284,7 @@ KineticStatus KineticOperation_GetCallback(KineticOperation* operation)
{
    assert(operation != NULL);
    assert(operation->connection != NULL);
    LOG_LOCATION; LOGF3("GET callback w/ operation (0x%0llX) on connection (0x%0llX)",
    LOGF3("GET callback w/ operation (0x%0llX) on connection (0x%0llX)",
        operation, operation->connection);
    assert(operation->entryEnabled);

@@ -327,7 +327,7 @@ KineticStatus KineticOperation_DeleteCallback(KineticOperation* operation)
{
    assert(operation != NULL);
    assert(operation->connection != NULL);
    LOG_LOCATION; LOGF3("DELETE callback w/ operation (0x%0llX) on connection (0x%0llX)",
    LOGF3("DELETE callback w/ operation (0x%0llX) on connection (0x%0llX)",
        operation, operation->connection);
    assert(operation->entryEnabled);
    return KINETIC_STATUS_SUCCESS;
@@ -359,8 +359,7 @@ KineticStatus KineticOperation_GetKeyRangeCallback(KineticOperation* operation)
{
    assert(operation != NULL);
    assert(operation->connection != NULL);
    
    LOG_LOCATION; LOGF3("GETKEYRANGE callback w/ operation (0x%0llX) on connection (0x%0llX)",
    LOGF3("GETKEYRANGE callback w/ operation (0x%0llX) on connection (0x%0llX)",
        operation, operation->connection);
    assert(operation->buffers != NULL);
    assert(operation->buffers->count > 0);
+8 −3
Original line number Diff line number Diff line
@@ -48,6 +48,8 @@ static uint8_t TagData[1024];
static ByteBuffer TagBuffer;
static uint8_t VersionData[1024];
static ByteBuffer VersionBuffer;
static uint8_t ExpectedVersionData[1024];
static ByteBuffer ExpectedVersionBuffer;
static ByteArray TestValue;
static uint8_t ValueData[KINETIC_OBJ_SIZE];
static ByteBuffer ValueBuffer;
@@ -63,6 +65,8 @@ void setUp(void)
    ByteBuffer_AppendCString(&TagBuffer, "SomeTagValue");
    VersionBuffer = ByteBuffer_Create(VersionData, sizeof(VersionData), 0);
    ByteBuffer_AppendCString(&VersionBuffer, "v1.0");
    ExpectedVersionBuffer = ByteBuffer_Create(ExpectedVersionData, sizeof(ExpectedVersionData), 0);
    ByteBuffer_AppendCString(&ExpectedVersionBuffer, "v1.0");
    TestValue = ByteArray_CreateWithCString("lorem ipsum... blah blah blah... etc.");
    ValueBuffer = ByteBuffer_Create(ValueData, sizeof(ValueData), 0);
    ByteBuffer_AppendArray(&ValueBuffer, TestValue);
@@ -81,12 +85,13 @@ void setUp(void)
    KineticStatus status = KineticClient_Put(Fixture.handle, &putEntry, NULL);
    TEST_ASSERT_EQUAL_KineticStatus(KINETIC_STATUS_SUCCESS, status);

    TEST_ASSERT_NOT_NULL(putEntry.dbVersion.array.data);
    TEST_ASSERT_EQUAL(strlen("v1.0"), putEntry.dbVersion.bytesUsed);
    TEST_ASSERT_ByteBuffer_NULL(putEntry.newVersion);
    // TEST_ASSERT_NOT_NULL(putEntry.dbVersion.array.data);
    // TEST_ASSERT_EQUAL(strlen("v1.0"), putEntry.dbVersion.bytesUsed);
    TEST_ASSERT_EQUAL_ByteBuffer(KeyBuffer, putEntry.key);
    TEST_ASSERT_EQUAL_ByteBuffer(TagBuffer, putEntry.tag);
    TEST_ASSERT_EQUAL(KINETIC_ALGORITHM_SHA1, putEntry.algorithm);
    TEST_ASSERT_EQUAL_ByteBuffer(ExpectedVersionBuffer, putEntry.dbVersion);
    TEST_ASSERT_ByteBuffer_NULL(putEntry.newVersion);

    Fixture.expectedSequence++;
    sleep(1);
Loading