pw_kvs: Move reading and writing to Entry class

- Add the FlashPartition and address to the Entry class.
- Move functions for reading or writing the entry header, key, and value
  to the Entry class.

Change-Id: I0af3c140a519c8b050fcef81eca4f3b45560f75c
diff --git a/pw_kvs/public/pw_kvs/checksum.h b/pw_kvs/public/pw_kvs/checksum.h
index 3acb5a4..e9cb85f 100644
--- a/pw_kvs/public/pw_kvs/checksum.h
+++ b/pw_kvs/public/pw_kvs/checksum.h
@@ -88,6 +88,8 @@
   ~AlignedChecksum() = default;
 
  private:
+  static_assert(kBufferSize >= kAlignmentBytes);
+
   void Finalize() final {
     writer_.Flush();
     FinalizeAligned();
diff --git a/pw_kvs/public/pw_kvs/flash_memory.h b/pw_kvs/public/pw_kvs/flash_memory.h
index a10af48..5d8f558 100644
--- a/pw_kvs/public/pw_kvs/flash_memory.h
+++ b/pw_kvs/public/pw_kvs/flash_memory.h
@@ -150,6 +150,9 @@
                                               : alignment_bytes),
         permission_(permission) {}
 
+  FlashPartition(const FlashPartition&) = delete;
+  FlashPartition& operator=(const FlashPartition&) = delete;
+
   virtual ~FlashPartition() = default;
 
   // Performs any required partition or flash-level initialization.
@@ -196,6 +199,11 @@
                                 size_t len,
                                 bool* is_erased);
 
+  // Checks to see if the data appears to be erased. No reads or writes occur;
+  // the FlashPartition simply compares the data to
+  // flash_.erased_memory_content().
+  bool AppearsErased(span<const std::byte> data) const;
+
   // Overridden by derived classes. The reported sector size is space available
   // to users of FlashPartition. It accounts for space reserved in the sector
   // for FlashPartition to store metadata.
diff --git a/pw_kvs/public/pw_kvs/key_value_store.h b/pw_kvs/public/pw_kvs/key_value_store.h
index 2f1c91a..b29058d 100644
--- a/pw_kvs/public/pw_kvs/key_value_store.h
+++ b/pw_kvs/public/pw_kvs/key_value_store.h
@@ -86,12 +86,13 @@
 
  public:
   // TODO: Make these configurable
-  static constexpr size_t kMaxKeyLength = 64;
   static constexpr size_t kMaxEntries = 256;
   static constexpr size_t kMaxUsableSectors = 256;
   static constexpr size_t kWorkingBufferSizeBytes = (4 * 1024);
 
-  // +1 for null-terminator.
+  // TODO: Remove the duplicate kMaxKeyLength and KeyBuffer definitions. These
+  // should be provided by the Entry class.
+  static constexpr size_t kMaxKeyLength = 0b111111;
   using KeyBuffer = std::array<char, kMaxKeyLength + 1>;
 
   // In the future, will be able to provide additional EntryHeaderFormats for
@@ -301,22 +302,11 @@
         key, const_cast<const KeyDescriptor**>(result));
   }
 
-  Status ReadEntryHeader(Address address, Entry* header) const;
-  Status ReadEntryKey(Address address, size_t key_length, char* key) const;
-
-  StatusWithSize ReadEntryValue(const KeyDescriptor& key_descriptor,
-                                const Entry& header,
-                                span<std::byte> value) const;
-
   Status LoadEntry(Address entry_address, Address* next_entry_address);
   Status AppendNewOrOverwriteStaleExistingDescriptor(
       const KeyDescriptor& key_descriptor);
   Status AppendEmptyDescriptor(KeyDescriptor** new_descriptor);
 
-  Status ValidateEntryChecksumInFlash(const Entry& header,
-                                      std::string_view key,
-                                      const KeyDescriptor& entry) const;
-
   Status WriteEntryForExistingKey(KeyDescriptor* key_descriptor,
                                   KeyDescriptor::State new_state,
                                   std::string_view key,
@@ -337,8 +327,6 @@
 
   SectorDescriptor* FindSectorToGarbageCollect();
 
-  bool HeaderLooksLikeUnwrittenData(const Entry& header) const;
-
   KeyDescriptor* FindDescriptor(uint32_t hash);
 
   Status AppendEntry(SectorDescriptor* sector,