Define AlignedWriter::Write overload that reads into the internal buffer
from an Input and writes it aligned to the output.
Change-Id: I72c1dead8cdcb912bf44fd1e36940cdb741f92df
- Provide StatusWithSize constants that can be used similarly to
Status::Codes. For example, StatusWithSize::DATA_LOSS constructs a
StatusWithSize with status DATA_LOSS and size 0.
- Remove the default constructor argument for the size. Use the
constants instead.
- Update uses of StatusWithSize(Status::X) to use StatusWithSize::X.
Change-Id: I901b7bb0bbbb4fde52f6b3acc3047f366b250515
- Add error injection features to InMemoryFakeFlash. Reads or Writes can
be programmed to fail.
- Introduce key_value_store_error_handling_test.cc, which focuses on
corruption and read/write failure cases.
- Add functions for creating binary KVS entries at compile time.
Change-Id: Ie52ba5eb13eb60244835ef43314282beacc3a659
- 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
- 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
- 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
- Disallow implicit conversions between Status and StatusWithSize, which
can be problematic.
- Add TRY_WITH_SIZE to pw_kvs to handle returning StatusWithSize from
functions.
- Make zero the default size argument for StatusWithSize.
- Expand tests for StatusWithSize.
Change-Id: Ia1c36e5a39402a50138d93e89afbaa5e772adb8a
- Always pad entries to their alignment instead of the flash's
alignment, which may be smaller.
- Checksum entire entries, including padding. The checksum is calculated
with the checksum field set to 0.
Change-Id: Ie354bf3fb93f23354d2278e5b16bd7d448728d95
- 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
- Provide AlignedChecksum class that uses AlignedWriter to ensure that
checksum updates are aligned as required.
- Make Finish() non-virtual and call an optional Finalize() operation
instead.
Change-Id: I5b16468b6a55c0c2c9f2c06e37988970af147a11
- Define the Output interface.
- Create AlignedWriter class, which handles writing aligned and padded
data to a buffer.
- Define AlignedWriterBuffer, which provides a buffer to an
AlignedWriter.
Change-Id: I791c5fc2d47617b0866fa779a506cb977905f245
- 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
- Implement Delete function.
- Add new tests and enable a few that pass now.
- Have out-of-bounds flash reads return OUT_OF_RANGE to differentiate
from INVALID_ARGUMENT.
Change-Id: I5d65ad36913b30f2554bd12eaba26127ae0ec8f2
Add implementation for RelocateEntry().
Add 4K buffer member to the KeyValueStore class for use with relocation
and general use.
Change-Id: I29d30fe539959464be8ac624454ff4c94c3cc54f
- Replace placeholder VerifyEntry function with the real verification
function, VerifyChecksumInFlash.
- Have VerifyChecksumInFlash read everything from flash, not just the
value.
- Fix missing bytes_to_read updates.
Change-Id: If856c60dee710bea128684fd1bb22d3e7fc62793
- Allow checksums to verify data larger than their internal state. This
facilitates using a CRC16 in a uint32_t.
- Move checksum functions to the EntryHeader class, since it ultimately
stores the checksums and is included with it.
- Enable one checksum test. Further tests are needed.
- Make some tweaks to the Get overload for objects.
Change-Id: I989b72905e140794f75c8f8619aaab1623f6f195
This starts the implementation of loading the KVS from flash. Much
remains to do before this is done. This patch also includes some
extensions to how the tests are handled, to make it easier to
instantiate multiple KVS and flash backends for testing.
Changes is this CL to potentially split out:
- KVS dump command to log contents
- Re-enabling function and file display in log (useful!)
- Hex dumping to log
Change-Id: Ib1b25a01aa29eec3d3acd09e40205c23ded7bf6a
Builds, but lots more work needed.
Fun fact: this code was written collaboratively in a Google Doc.
Change-Id: I8a89c5d0fdc71ec28cf432350e65d17e24a6f25c