Commit 00265a94 authored by Greg Williams's avatar Greg Williams
Browse files

Final cleanup for converting operation association with KineticEntry to be a...

Final cleanup for converting operation association with KineticEntry to be a pointer instead of a copy for consistency
parent f0910612
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -198,13 +198,9 @@ KineticStatus KineticConnection_Connect(KineticConnection* const connection)
    }

    // Kick off the worker thread
    connection->threadCreated = false;
    connection->thread.connection = connection;
    int pthreadStatus = pthread_create(&connection->threadID, NULL, KineticConnection_Worker, &connection->thread);
    if (pthreadStatus == 0) {
        connection->threadCreated = true;
    }
    else {
    if (pthreadStatus != 0) {
        char errMsg[256];
        Kinetic_GetErrnoDescription(pthreadStatus, errMsg, sizeof(errMsg));
        LOGF0("Failed creating worker thread w/error: %s", errMsg);
+3 −9
Original line number Diff line number Diff line
@@ -232,8 +232,6 @@ void KineticOperation_BuildNoop(KineticOperation* const operation)
    KineticConnection_IncrementSequence(operation->connection);
    operation->request->protoData.message.command.header->messageType = KINETIC_PROTO_COMMAND_MESSAGE_TYPE_NOOP;
    operation->request->protoData.message.command.header->has_messageType = true;

    operation->entryEnabled = false;
    operation->valueEnabled = false;
    operation->sendValue = true;
    operation->callback = &KineticOperation_NoopCallback;
@@ -245,7 +243,7 @@ KineticStatus KineticOperation_PutCallback(KineticOperation* operation)
    assert(operation->connection != NULL);
    LOGF3("PUT callback w/ operation (0x%0llX) on connection (0x%0llX)",
        operation, operation->connection);
    assert(operation->entryEnabled);
    assert(operation->entry != NULL);

    // Propagate newVersion to dbVersion in metadata, if newVersion specified
    KineticEntry* entry = operation->entry;
@@ -279,7 +277,6 @@ void KineticOperation_BuildPut(KineticOperation* const operation,

    KineticMessage_ConfigureKeyValue(&operation->request->protoData.message, operation->entry);

    operation->entryEnabled = true;
    operation->valueEnabled = !operation->entry->metadataOnly;
    operation->sendValue = true;
    operation->callback = &KineticOperation_PutCallback;
@@ -291,7 +288,7 @@ KineticStatus KineticOperation_GetCallback(KineticOperation* operation)
    assert(operation->connection != NULL);
    LOGF3("GET callback w/ operation (0x%0llX) on connection (0x%0llX)",
        operation, operation->connection);
    assert(operation->entryEnabled);
    assert(operation->entry != NULL);

    // Update the entry upon success
    KineticProto_Command_KeyValue* keyValue = KineticPDU_GetKeyValue(operation->response);
@@ -322,7 +319,6 @@ void KineticOperation_BuildGet(KineticOperation* const operation,
        ByteBuffer_Reset(&operation->entry->value);
    }

    operation->entryEnabled = true;
    operation->valueEnabled = !entry->metadataOnly;
    operation->sendValue = false;
    operation->callback = &KineticOperation_GetCallback;
@@ -334,7 +330,7 @@ KineticStatus KineticOperation_DeleteCallback(KineticOperation* operation)
    assert(operation->connection != NULL);
    LOGF3("DELETE callback w/ operation (0x%0llX) on connection (0x%0llX)",
        operation, operation->connection);
    assert(operation->entryEnabled);
    assert(operation->entry != NULL);
    return KINETIC_STATUS_SUCCESS;
}

@@ -354,7 +350,6 @@ void KineticOperation_BuildDelete(KineticOperation* const operation,
        ByteBuffer_Reset(&operation->entry->value);
    }

    operation->entryEnabled = true;
    operation->valueEnabled = false;
    operation->sendValue = false;
    operation->callback = &KineticOperation_DeleteCallback;
@@ -394,7 +389,6 @@ void KineticOperation_BuildGetKeyRange(KineticOperation* const operation,

    KineticMessage_ConfigureKeyRange(&operation->request->protoData.message, range);

    operation->entryEnabled = false;
    operation->valueEnabled = false;
    operation->sendValue = false;
    operation->buffers = buffers;
+0 −11
Original line number Diff line number Diff line
@@ -92,7 +92,6 @@ struct _KineticConnection {
    KineticSession  session;        // session configuration
    KineticThread   thread;         // worker thread instance struct
    pthread_t       threadID;       // worker pthread
    bool            threadCreated;  // thread creation status
};
#define KINETIC_CONNECTION_INIT(_con) { (*_con) = (KineticConnection) { \
        .connected = false, \
@@ -216,9 +215,6 @@ struct _KineticPDU {
    bool protobufDynamicallyExtracted;
    KineticProto_Command* command;

    // // Object meta-data to be used/populated if provided and pertinent to the operation
    // KineticEntry entry;

    // Embedded HMAC instance
    KineticHMAC hmac;

@@ -230,12 +226,6 @@ struct _KineticPDU {

    // Kinetic operation associated with this PDU, if any
    KineticOperation* operation;

    // // PDU associated with this one (for associating request and response PDUs for operations)
    // KineticPDU* associatedPDU;

    // // Operation complete closure
    // KineticCompletionClosure closure;
};

#define KINETIC_PDU_INIT(_pdu, _con) { \
@@ -267,7 +257,6 @@ struct _KineticOperation {
    KineticConnection* connection;
    KineticPDU* request;
    KineticPDU* response;
    bool entryEnabled;
    bool valueEnabled;
    bool sendValue;
    bool receiveComplete;
+0 −2
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@ void SystemTestSetup(SystemTestFixture* fixture)
                .nonBlocking = false,
                .hmacKey = hmacArray,
            },
            .keyToDelete = BYTE_BUFFER_NONE,
            .connected = fixture->connected,
            .testIgnored = false,
        };
@@ -52,7 +51,6 @@ void SystemTestSetup(SystemTestFixture* fixture)
        TEST_ASSERT_EQUAL_KineticStatus(KINETIC_STATUS_SUCCESS, status);
        fixture->expectedSequence = 0;
        fixture->connected = true;
        fixture->keyToDelete = ByteBuffer_Create(fixture->keyData, sizeof(fixture->keyData), 0);
    }
    else {
        fixture->testIgnored = false;
+0 −2
Original line number Diff line number Diff line
@@ -34,8 +34,6 @@ typedef struct _SystemTestFixture {
    bool testIgnored;
    bool connected;
    int64_t expectedSequence;
    uint8_t keyData[256];
    ByteBuffer keyToDelete;
} SystemTestFixture;

void SystemTestSetup(SystemTestFixture* fixture);
Loading