Commit Graph

6 Commits

Author SHA1 Message Date
Wyatt Hepler
38ce30f766 pw_kvs: Allow specifying max entries and sectors
Move the KeyDescriptor and SectorDescriptor lists to a templated derived
KeyValueStoreBuffer class. This allows multiple KVSs supporting
different numbers of keys and sectors to exist side-by-side.

Change-Id: I43d0647382e763008ae3b08580c736c1978793dd
2020-02-21 00:25:43 +00:00
Wyatt Hepler
a00d1ef82c pw_kvs: Expand Entry tests; fix issues
- Expand the tests for the KVS entry class.
- Fix a few minor issues found by the tests.

Change-Id: I92b5dd614d2a726c912b7b1bf1f9ebd47a702be4
2020-02-19 11:12:01 -08:00
Wyatt Hepler
cdd6dfcfc6 pw_kvs: FlashMemory updates; test utilities
- Update comments for FlashMemory class.
- Split InMemoryFakeFlash to move the fixed-size buffer into the
  derived FakeFlashBuffer class.
- Support initializing FakeFlashBuffer to data provided at construction.
- Allow direct access to the underlying fake flash buffer for testing.
- Create utilities for working with byte arrays in byte_utils.h.

Change-Id: I90d33621cb91da079d7213fe7d33823494120e48
2020-02-19 19:10:32 +00:00
Wyatt Hepler
e541e075d4 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
2020-02-14 16:21:29 -08:00
Wyatt Hepler
0af6ad9365 pw_kvs: Use key's current state in RelocateEntry
When moving tombstone entries for deleted keys, RelocateEntry would
cause them to become present again.

Expand key_value_store_map_test.cc and add a test that covers this case
specifically.

Change-Id: I846cb155bffb25198377e04752cace971555d32b
2020-02-14 00:50:52 +00:00
Wyatt Hepler
495b6ee5ce pw_kvs: Map-backed tests
Introduce a system for writing tests against flash memories with
different parameters. The tests use a std::unordered_map as an oracle,
and all operations are checked against it. Invalid inputs and the KVS
filling up are handled.

Disable most of the tests because they are currently failing.

Change-Id: Ib817e30a199c81b3146823252be91e0db016c9b3
2020-02-13 21:50:30 +00:00