pw_status: Replace Status::Ok() with OkStatus()
- Mark Status::Ok() and StatusWithSize::Ok() as deprecated.
- Replace Status::Ok() with OkStatus().
- Replace StatusWithSize::Ok() with StatusWithSize().
Change-Id: If7192282446bf6d7f90990bb0b4f1b1b89a9228a
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/29003
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Keir Mierle <keir@google.com>
diff --git a/pw_kvs/key_value_store.cc b/pw_kvs/key_value_store.cc
index 77ed52d..6c2a1a6 100644
--- a/pw_kvs/key_value_store.cc
+++ b/pw_kvs/key_value_store.cc
@@ -134,7 +134,7 @@
return Status::DataLoss();
}
- return Status::Ok();
+ return OkStatus();
}
Status KeyValueStore::InitializeMetadata() {
@@ -295,7 +295,7 @@
unsigned(entry_copies_missing));
return Status::FailedPrecondition();
}
- return Status::Ok();
+ return OkStatus();
}
KeyValueStore::StorageStats KeyValueStore::GetStorageStats() const {
@@ -394,7 +394,7 @@
if (formats_.KnownMagic(magic)) {
DBG("Found entry magic at address %u", unsigned(address));
*next_entry_address = address;
- return Status::Ok();
+ return OkStatus();
}
}
@@ -605,7 +605,7 @@
if (!initialized()) {
return Status::FailedPrecondition();
}
- return Status::Ok();
+ return OkStatus();
}
Status KeyValueStore::CheckReadOperation(Key key) const {
@@ -618,7 +618,7 @@
if (initialized_ == InitializationState::kNotInitialized) {
return Status::FailedPrecondition();
}
- return Status::Ok();
+ return OkStatus();
}
Status KeyValueStore::WriteEntryForExistingKey(EntryMetadata& metadata,
@@ -659,7 +659,7 @@
// keep the existing entry.
DBG("Write for key 0x%08x with matching value skipped",
unsigned(prior_metadata->hash()));
- return Status::Ok();
+ return OkStatus();
}
// List of addresses for sectors with space for this entry.
@@ -686,7 +686,7 @@
PW_TRY(AppendEntry(entry, key, value));
new_metadata.AddNewAddress(reserved_addresses[i]);
}
- return Status::Ok();
+ return OkStatus();
}
KeyValueStore::EntryMetadata KeyValueStore::CreateOrUpdateKeyDescriptor(
@@ -730,7 +730,7 @@
unsigned(write_addresses[i]));
}
- return Status::Ok();
+ return OkStatus();
}
// Finds a sector to use for writing a new entry to. Does automatic garbage
@@ -813,7 +813,7 @@
sector.RemoveWritableBytes(result.size());
sector.AddValidBytes(result.size());
- return Status::Ok();
+ return OkStatus();
}
StatusWithSize KeyValueStore::CopyEntryToSector(Entry& entry,
@@ -864,7 +864,7 @@
sectors_.FromAddress(address).RemoveValidBytes(result_size);
address = new_address;
- return Status::Ok();
+ return OkStatus();
}
Status KeyValueStore::FullMaintenanceHelper(MaintenanceType maintenance_type) {
@@ -976,7 +976,7 @@
}
}
- return Status::Ok();
+ return OkStatus();
};
Status KeyValueStore::GarbageCollectSector(
@@ -1008,7 +1008,7 @@
}
DBG(" Garbage Collect sector %u complete", sectors_.Index(sector_to_gc));
- return Status::Ok();
+ return OkStatus();
}
StatusWithSize KeyValueStore::UpdateEntriesToPrimaryFormat() {
@@ -1078,7 +1078,7 @@
metadata.AddNewAddress(new_address);
}
- return Status::Ok();
+ return OkStatus();
}
Status KeyValueStore::RepairCorruptSectors() {
@@ -1086,7 +1086,7 @@
// sector failed on the first pass, then do a second pass, since a later
// sector might have cleared up space or otherwise unblocked the earlier
// failed sector.
- Status repair_status = Status::Ok();
+ Status repair_status = OkStatus();
size_t loop_count = 0;
do {
@@ -1094,7 +1094,7 @@
// Error of RESOURCE_EXHAUSTED indicates no space found for relocation.
// Reset back to OK for the next pass.
if (repair_status == Status::ResourceExhausted()) {
- repair_status = Status::Ok();
+ repair_status = OkStatus();
}
DBG(" Pass %u", unsigned(loop_count));
@@ -1117,7 +1117,7 @@
}
Status KeyValueStore::EnsureFreeSectorExists() {
- Status repair_status = Status::Ok();
+ Status repair_status = OkStatus();
bool empty_sector_found = false;
DBG(" Find empty sector");
@@ -1141,11 +1141,11 @@
}
Status KeyValueStore::EnsureEntryRedundancy() {
- Status repair_status = Status::Ok();
+ Status repair_status = OkStatus();
if (redundancy() == 1) {
DBG(" Redundancy not in use, nothting to check");
- return Status::Ok();
+ return OkStatus();
}
DBG(" Write any needed additional duplicate copies of keys to fulfill %u"