pw_software_update: Add finalize and manifest get/update for backend

Add get/update methods for the current manifest in the update backend.
Add FinalzeUpdate method to finish the update and trigger the device
reboot.

No-Docs-Update-Reason: Module still in early development
Change-Id: Ib59e15cedefc865b60e3bbd111e8f5fd0e64ad88
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/61621
Pigweed-Auto-Submit: David Rogers <davidrogers@google.com>
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
diff --git a/pw_software_update/public/pw_software_update/update_backend.h b/pw_software_update/public/pw_software_update/update_backend.h
index 856df65..c2aaf90 100644
--- a/pw_software_update/public/pw_software_update/update_backend.h
+++ b/pw_software_update/public/pw_software_update/update_backend.h
@@ -70,19 +70,44 @@
     return OkStatus();
   };
 
-  // Perform any product-specific tasks needed after completion of the update.
-  virtual Status AfterUpdateComplete() { return OkStatus(); };
+  // Do any work needed to finalize the update including doing a required
+  // reboot of the device! This is called after all software update state and
+  // breadcrumbs have been cleaned up.
+  //
+  // After the reboot the update is fully complete.
+  PW_NO_RETURN virtual void FinalizeUpdate() = 0;
+
+  // Get reader of the device's current manifest.
+  virtual Status GetCurrentManifestReader(
+      [[maybe_unused]] stream::Reader* out) {
+    return Status::Unimplemented();
+  };
+
+  // Use a reader that provides a new manifest for the device to save.
+  virtual Status UpdateCurrentManifest(
+      [[maybe_unused]] stream::Reader& root_metadata) {
+    return OkStatus();
+  };
 
   // Get reader of the device's root metadata.
+  //
+  // This method ALWAYS needs to be able to return a valid root metadata.
+  // Failure to have a safe update can result in inability to do future
+  // updates due to not having required metadata.
   virtual Status GetRootMetadataReader([[maybe_unused]] stream::Reader* out) {
     return Status::Unimplemented();
   };
 
   // Use a reader that provides a new root metadata for the device to save.
+  //
+  // This method needs to do updates in a reliable and failsafe way with no
+  // window of vulnerability. It needs to ALWAYS be able to return a valid root
+  // metadata. Failure to have a safe update can result in inability to do
+  // future updates due to not having required metadata.
   virtual Status UpdateRootMetadata(
       [[maybe_unused]] stream::Reader& root_metadata) {
     return OkStatus();
   };
 };
 
-}  // namespace pw::software_update
\ No newline at end of file
+}  // namespace pw::software_update