pw_kvs: Add part of the garbage collection implementation
Add part of the KVS garbage collection. This gets most of what is
needed, with only the RelocateEntry() method needing work.
Change-Id: Icff1926f43e620d9f48ffb0b94d8c8139836c30a
diff --git a/pw_kvs/public/pw_kvs/flash_memory.h b/pw_kvs/public/pw_kvs/flash_memory.h
index 5495141..06a5148 100644
--- a/pw_kvs/public/pw_kvs/flash_memory.h
+++ b/pw_kvs/public/pw_kvs/flash_memory.h
@@ -189,15 +189,13 @@
size_t len,
bool* is_erased);
- constexpr uint32_t sector_size_bytes() 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.
+ virtual uint32_t sector_size_bytes() const {
return flash_.sector_size_bytes();
}
- // Overridden by base classes which store metadata at the start of a sector.
- virtual uint32_t sector_available_size_bytes() const {
- return sector_size_bytes();
- }
-
size_t size_bytes() const { return sector_count() * sector_size_bytes(); }
virtual size_t alignment_bytes() const { return flash_.alignment_bytes(); }