Commit Graph

15 Commits

Author SHA1 Message Date
Wyatt Hepler
486ac57fef pw_kvs: Small test cleanup
- Reorder entry_test.cc and add an additional test for Copy.
- Add comments to key_value_store_map_test.cc.

Change-Id: Icd02db02e6a8be63b7a09688c997c3dd72c45ad9
2020-03-13 09:19:23 -07:00
Wyatt Hepler
1d59456cb6 pw_kvs: Functions for updating and copying entries
- The Update function changes the magic, checksum, and transaction ID
  for an entry.
- The Copy function copies an entry from one address to another,
  potentially updating the format in the process.
- Rename checksum_ to checksum_algo_ to differentiate it from the
  calculated checksum.

Change-Id: I04c31a17e64696696196815bbc4f5308bfbe2b28
2020-03-11 12:09:47 -07:00
Wyatt Hepler
22d0d9fcb0 pw_kvs: Support multiple entry formats
Change-Id: If25ea00210178b8495585a651d3df6ad8347ee82
2020-03-05 17:36:45 -08:00
Wyatt Hepler
7465be38c1 pw_kvs: Remove unnecessary alignment_bytes arg
Change-Id: Ie8288f870a182ac0d5d9a3764bcce96a713247db
2020-02-24 16:28:55 +00:00
Wyatt Hepler
88adfe8b91 pw_kvs: Move EntryHeaderFormat to pw_kvs/format.h
- Move EntryHeaderFormat and the EntryHeader struct to pw_kvs/format.h.
- Rename EntryHeaderFormat to EntryFormat.

Change-Id: Ic5e53c688cd3a483101c7985def6e4bef9c3cbaf
2020-02-21 09:34:31 -08:00
Wyatt Hepler
bdd8e5a77b pw_kvs: Move entry.h to public/pw_kvs/internal
Move entry.h so that the KeyValueStore class can reference it in the
header.

Change-Id: Ib5a7f194db8dd9af1e8f3d8c9c7c25b8409acfe0
2020-02-20 19:30:47 -08:00
Wyatt Hepler
1fc1104cb5 pw_kvs: Transcation ID and key descriptor refactor
- Switch from per-key versions to a monotonically increasing KVS-global
  transcation ID.
- Move KeyDescriptor and the hash function to their own files.

Change-Id: I05287137579d4fe2d72c6e176969d46006c2aae6
2020-02-20 16:26:27 -08:00
Wyatt Hepler
5f6efc0fed pw_kvs: Allow specifying an offset in Get
Change-Id: Id0b27a3b7cf3d7fe53e934e2a4822f00f21cb517
2020-02-19 15:40:04 -08: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
d31d97070f pw_kvs: Rename format.h to entry.h
Change-Id: Iad7148cad736d57a9ff5d23772a002c40508b6d4
2020-02-14 18:08:50 +00:00
Wyatt Hepler
30a5215045 pw_kvs: Rename EntryHeader to Entry
- Rename EntryHeader to Entry, since it is more than just the
  EntryHeader.
- Introduce POD EntryHeader struct that represents the on-disk entry
  format.
- Remove unused set functions.

Change-Id: I407d615e559ad77824fbd6c6db66aa2c666c1c1e
2020-02-13 10:43:32 -08:00
Wyatt Hepler
0bde10a529 pw_kvs: Test cleanup
- Rename the KeyValueStoreTest fixture to a more descriptive name:
  EmptyInitializedKvs.
- Remove references to sector headers, which no longer exist.
- Enable the LargePartition test, which now passes.
- Remove the EntryHeader test, which is covered in entry_test.cc.
- Remove the Delete, BadCrc, and TestVersion2 tests, which are specific
  to old flash layouts and no longer apply.

Change-Id: I871c54ce82a4ca8fa5bba24d7cca4469d1324f60
2020-02-07 22:28:48 +00:00
Wyatt Hepler
97fc794536 pw_kvs: Introduce alignment to the entry header
- Add an 8-bit alignment field to the entry header. This makes the
  entry header a complete description of the entry's representation in
  flash (assuming the checksum algorithm is implied by the magic).
- Write basic tests for the EntryHeader class.

Change-Id: I7e48d5c16451ceb81f7c191d2f261e0a9bef14b7
2020-02-07 00:34:58 +00:00