Commit 56d40650 authored by Marshall Pierce's avatar Marshall Pierce
Browse files

Merge pull request #25 from Seagate/features/persist-mode

Features/persist mode
parents bbe8dc9e 1c5a2cbc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ else(USE_LOCAL_KINETIC_CLIENT)
        kinetic_cpp_client
        PREFIX "vendor"
        GIT_REPOSITORY "https://github.com/Seagate/kinetic-cpp-client.git"
        GIT_TAG "161c2b7005c7c2b33e6de8197869efb4454d000b"
        GIT_TAG "0.0.3"
        BUILD_IN_SOURCE 1
        INSTALL_COMMAND ""
    )
+8 −2
Original line number Diff line number Diff line
@@ -75,7 +75,11 @@ int main(int argc, char* argv[]) {

        sprintf(key_buffer, "%s-%10" PRId64, kinetic_key, i);
        std::string key(key_buffer);
        if (blocking_connection->Delete(key, "", kinetic::IGNORE_VERSION).ok()) {

        // Use the Write Back persist mode for the data deletes, and then use Flush for the
        // metadata below to ensure everything is persisted by the time we exit.
        if (blocking_connection->Delete(key, "",
                kinetic::WriteMode::IGNORE_VERSION, kinetic::PersistMode::WRITE_BACK).ok()) {
            printf(".");
        } else {
            printf("X");
@@ -83,7 +87,9 @@ int main(int argc, char* argv[]) {
        fflush(stdout);
    }

    if (!blocking_connection->Delete(kinetic_key, "", kinetic::IGNORE_VERSION).ok()) {
    // Use the Flush persist mode to make sure all previous deletes are persisted
    if (!blocking_connection->Delete(kinetic_key, "",
            kinetic::WriteMode::IGNORE_VERSION, kinetic::PersistMode::FLUSH).ok()) {
        printf("Unable to delete metadata\n");
    }

+7 −2
Original line number Diff line number Diff line
@@ -103,11 +103,16 @@ int main(int argc, char* argv[]) {
        sprintf(key_buffer, "%s-%10" PRId64, kinetic_key, i);
        remaining++;
        std::string key(key_buffer);
        nonblocking_connection->Delete(key, "", kinetic::IGNORE_VERSION, callback);
        // Use the Write Back persist mode for the data deletes, and then use Flush for the
        // metadata below to ensure everything is persisted by the time we exit.
        nonblocking_connection->Delete(key, "", kinetic::WriteMode::IGNORE_VERSION,
                callback, kinetic::PersistMode::WRITE_BACK);
    }

    remaining++;
    nonblocking_connection->Delete(kinetic_key, "", kinetic::IGNORE_VERSION, callback);
    // Use the Flush persist mode to make sure all previous deletes are persisted
    nonblocking_connection->Delete(kinetic_key, "", kinetic::WriteMode::IGNORE_VERSION,
                callback, kinetic::PersistMode::FLUSH);


    fd_set read_fds, write_fds;
+9 −4
Original line number Diff line number Diff line
@@ -65,11 +65,14 @@ int example_main(

        std::string key(key_buffer);
        std::string value(inputfile_data + i, value_size);
        // Use the Write Back persist mode for the data puts, and then use Flush for the metadata
        // below to ensure everything is persisted by the time we exit.
        if(!blocking_connection->Put(
                key,
                "",
                kinetic::IGNORE_VERSION,
                KineticRecord(value, "", "", Message_Algorithm_SHA1)).ok()) {
                kinetic::WriteMode::IGNORE_VERSION,
                KineticRecord(value, "", "", Message_Algorithm_SHA1),
                kinetic::PersistMode::WRITE_BACK).ok()) {
            printf("Unable to write a chunk\n");
            return 1;
        }
@@ -79,11 +82,13 @@ int example_main(
    printf("\n");


    // Use the Flush persist mode to make sure all previous writes are persisted
    if (!blocking_connection->Put(
            FLAGS_kinetic_key,
            "",
            kinetic::IGNORE_VERSION,
            KineticRecord(to_string(inputfile_stat.st_size), "", "", Message_Algorithm_SHA1)).ok()) {
            kinetic::WriteMode::IGNORE_VERSION,
            KineticRecord(to_string(inputfile_stat.st_size), "", "", Message_Algorithm_SHA1),
            kinetic::PersistMode::FLUSH).ok()) {
        printf("Unable to write metadata\n");
        return 1;
    }
+9 −4
Original line number Diff line number Diff line
@@ -111,11 +111,13 @@ int main(int argc, char* argv[]) {

    printf("All threads joined\n");

    // Use the Flush persist mode to make sure all previous writes are persisted
    if (!blocking_connection->Put(
            kinetic_key,
            "",
            kinetic::IGNORE_VERSION,
            KineticRecord(std::to_string(inputfile_stat.st_size), "", "", Message_Algorithm_SHA1)).ok()) {
            kinetic::WriteMode::IGNORE_VERSION,
            KineticRecord(std::to_string(inputfile_stat.st_size), "", "", Message_Algorithm_SHA1),
            kinetic::PersistMode::FLUSH).ok()) {
        printf("Unable to write metadata\n");
        return 1;
    }
@@ -148,11 +150,14 @@ void put_range(int64_t start, int64_t end, int64_t total_size, const char* kinet

        std::string key(key_buffer);
        std::string value(inputfile_data + i, value_size);
        // Use the Write Back persist mode for the data puts, and then use Flush for the metadata
        // below to ensure everything is persisted by the time we exit.
        KineticStatus status = blocking_connection->Put(
                    key,
                    "",
                    kinetic::IGNORE_VERSION,
                    KineticRecord(value, "", "", Message_Algorithm_SHA1));
                    kinetic::WriteMode::IGNORE_VERSION,
                    KineticRecord(value, "", "", Message_Algorithm_SHA1),
                    kinetic::PersistMode::WRITE_BACK);
        if(!status.ok()) {
            printf("Unable to write chunk: %d %s\n", static_cast<int>(status.statusCode()),
                status.message().c_str());
Loading