diff --git a/crud/crud.cpp b/crud/crud.cpp index 586a0675..463f0642 100644 --- a/crud/crud.cpp +++ b/crud/crud.cpp @@ -372,7 +372,7 @@ crud::handle_ttl(const bzn::caller_id_t& /*caller_id*/, const database_msg& requ } } - this->send_response(request, (has) ? bzn::storage_result::ok : bzn::storage_result::not_found, std::move(response), session); + this->send_response(request, (has) ? bzn::storage_result::ok : bzn::storage_result::ttl_not_found, std::move(response), session); } @@ -413,7 +413,7 @@ crud::handle_persist(const bzn::caller_id_t& caller_id, const database_msg& requ } else { - result = bzn::storage_result::not_found; + result = bzn::storage_result::ttl_not_found; } } } diff --git a/crud/test/crud_test.cpp b/crud/test/crud_test.cpp index ebe3aad8..e5191d82 100644 --- a/crud/test/crud_test.cpp +++ b/crud/test/crud_test.cpp @@ -305,7 +305,7 @@ TEST(crud, test_that_point_of_contact_create_sends_proper_response) { database_response resp; ASSERT_TRUE(parse_env_to_db_resp(resp, msg->SerializeAsString())); - ASSERT_EQ(resp.error().message(), bzn::storage_result_msg.at(bzn::storage_result::not_found)); + ASSERT_EQ(resp.error().message(), bzn::storage_result_msg.at(bzn::storage_result::ttl_not_found)); })); crud->handle_request("caller_id", msg, nullptr); @@ -2252,7 +2252,12 @@ TEST(crud, test_that_key_with_expiration_can_be_made_persistent) // should be gone msg.mutable_ttl()->set_key("key"); - expect_signed_response(session, "uuid", 123, database_response::kError, bzn::storage_result_msg.at(bzn::storage_result::not_found)); + expect_signed_response(session, "uuid", 123, database_response::kError, bzn::storage_result_msg.at(bzn::storage_result::ttl_not_found)); + crud->handle_request("caller_id", msg, session); + + // make key persist that no longer exists + msg.mutable_persist()->set_key("key"); + expect_signed_response(session, "uuid", 123, database_response::kError, bzn::storage_result_msg.at(bzn::storage_result::ttl_not_found)); crud->handle_request("caller_id", msg, session); } diff --git a/storage/storage_base.hpp b/storage/storage_base.hpp index 98527766..880d8003 100644 --- a/storage/storage_base.hpp +++ b/storage/storage_base.hpp @@ -30,6 +30,7 @@ namespace bzn ok=0, not_found, exists, + ttl_not_found, not_saved, value_too_large, key_too_large, @@ -43,6 +44,7 @@ namespace bzn {storage_result::ok, "OK"}, {storage_result::not_found, "RECORD_NOT_FOUND"}, {storage_result::exists, "RECORD_EXISTS"}, + {storage_result::ttl_not_found, "TTL_RECORD_NOT_FOUND"}, {storage_result::not_saved, "NOT_SAVED"}, {storage_result::value_too_large, "VALUE_SIZE_TOO_LARGE"}, {storage_result::key_too_large, "KEY_SIZE_TOO_LARGE"},