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/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.