Commit Graph

5 Commits

Author SHA1 Message Date
Wyatt Hepler
289046011c pw_kvs: AlignedWriter read-and-write function
Define AlignedWriter::Write overload that reads into the internal buffer
from an Input and writes it aligned to the output.

Change-Id: I72c1dead8cdcb912bf44fd1e36940cdb741f92df
2020-03-10 20:34:40 +00:00
Wyatt Hepler
0f2ad9fce9 pw_kvs: Fix AlignedWrite issues; expand tests
- Update AlignedWriter to prevent writing after an error occurs.
- Ensure that the number of written bytes is always returned for
  AlignedWriter errors.
- Remove FlashError::Mode, since the number of bytes affected should
  always be set.
- Add tests to alignment_test.cc and key_value_store.cc to cover
  failures during AlignedWrite.
- Update some comments.

Change-Id: Id62f1564b3641be0aeb7f799f0fa0538a1b5b09e
2020-02-26 09:17:06 -08:00
David Rogers
6592d291e4 pw_kvs: Add free space accounting for write errors
Add accounting of byte written to flash when write operation has an error.

Change-Id: I4268cf36de16648fa10117fb6a828327685d4417
2020-02-21 03:03:28 +00:00
Wyatt Hepler
50f70779c8 Remove StatusWithSize implicit conversions
- 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
2020-02-14 17:59:00 +00:00
Wyatt Hepler
1927c2868b pw_kvs: Split out aligned write functionality
- 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
2020-02-12 17:00:09 -08:00