pw_persistent_memory: reset() -> invalidate()

Renames reset() to Invalidate(), as it better expresses that the
resulting object will be considered invalid after calling.

Change-Id: I288ac1118b3af80f84a260ee979b81b684a43b9b
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/41341
Commit-Queue: Armando Montanez <amontanez@google.com>
Pigweed-Auto-Submit: Armando Montanez <amontanez@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
diff --git a/pw_persistent_ram/docs.rst b/pw_persistent_ram/docs.rst
index ef99710..4e659c2 100644
--- a/pw_persistent_ram/docs.rst
+++ b/pw_persistent_ram/docs.rst
@@ -204,7 +204,7 @@
       if (persistent_crash_info.has_value()) {
         LogLastCrashInfo(persistent_crash_info.value());
         // Clear crash info once it has been dumped.
-        persistent_crash_info.reset();
+        persistent_crash_info.Invalidate();
       }
 
       // ... rest of main
diff --git a/pw_persistent_ram/persistent_test.cc b/pw_persistent_ram/persistent_test.cc
index bd3de4f..8c667ec 100644
--- a/pw_persistent_ram/persistent_test.cc
+++ b/pw_persistent_ram/persistent_test.cc
@@ -62,7 +62,7 @@
     auto& persistent = *(new (&buffer_) Persistent<uint32_t>());
     persistent = 42u;
     EXPECT_TRUE(persistent.has_value());
-    persistent.reset();
+    persistent.Invalidate();
 
     persistent.~Persistent();  // Emulate shutdown / global destructors.
   }
diff --git a/pw_persistent_ram/public/pw_persistent_ram/persistent.h b/pw_persistent_ram/public/pw_persistent_ram/persistent.h
index 2e53edf..404f500 100644
--- a/pw_persistent_ram/public/pw_persistent_ram/persistent.h
+++ b/pw_persistent_ram/public/pw_persistent_ram/persistent.h
@@ -108,12 +108,15 @@
   }
 
   // Destroys any contained value.
-  void reset() {
+  void Invalidate() {
     // The trivial destructor is skipped as it's trivial.
     std::memset(const_cast<T*>(&contents_), 0, sizeof(contents_));
     crc_ = 0;
   }
 
+  // This is deprecated, use Invalidate() instead.
+  [[deprecated]] void reset() { Invalidate(); }
+
   // Returns true if a value is held by the Persistent.
   bool has_value() const {
     return crc_ == CalculateCrc();  // There's a value if its CRC matches.
diff --git a/pw_persistent_ram/size_report/persistent.cc b/pw_persistent_ram/size_report/persistent.cc
index 8ffeafa..7389b3a 100644
--- a/pw_persistent_ram/size_report/persistent.cc
+++ b/pw_persistent_ram/size_report/persistent.cc
@@ -28,8 +28,8 @@
   // Assignment operator.
   persistent = 13u;
 
-  // Reset.
-  persistent.reset();
+  // Invalidate.
+  persistent.Invalidate();
 
   // Has value and value accesstors.
   if (persistent.has_value() && persistent.value() == 0u) {