class HashBlockAccumulator
Defined at line 19 of file ../../src/devices/block/drivers/block-verity/hash-block-accumulator.h
A class that contains a block-sized buffer, a write pointer, and a boolean
for tracking whether we've issued a write for the contents yet or not. We
use this class to accumulate the hashes of several blocks we read before
writing back a completed integrity block.
Future work could genericize this over block size and hash algorithm,
but for now it's expedient to assume 4k and SHA256 from constants.h.
Public Methods
void HashBlockAccumulator ()
Defined at line 15 of file ../../src/devices/block/drivers/block-verity/hash-block-accumulator.cc
void Reset ()
Zero the block buffer, reset the write offset `block_bytes_filled` to zero,
and set `write_requested_` to false.
Defined at line 18 of file ../../src/devices/block/drivers/block-verity/hash-block-accumulator.cc
void ~HashBlockAccumulator ()
Defined at line 22 of file ../../src/devices/block/drivers/block-verity/hash-block-accumulator.h
bool IsEmpty ()
True if block_bytes_filled is zero -- no bytes have been fed since `Reset`
was last called or construction.
Defined at line 24 of file ../../src/devices/block/drivers/block-verity/hash-block-accumulator.cc
bool IsFull ()
True if `block_bytes_filled` is `kBlockSize`. Semantically, this block is
full and ready to be written out to backing storage.
Defined at line 26 of file ../../src/devices/block/drivers/block-verity/hash-block-accumulator.cc
void Feed (const uint8_t * buf, size_t count)
Copy `count` bytes from `buf` to the next unset `block`, and increment
`block_bytes_filled` by `count`. This is called with the hash of some
lower block in the hash tree - either a leaf data block, or a lower-level
integrity block.
Defined at line 28 of file ../../src/devices/block/drivers/block-verity/hash-block-accumulator.cc
void PadBlockWithZeroesToFill ()
Feeds zeroes into the buffer until the block is full.
Defined at line 34 of file ../../src/devices/block/drivers/block-verity/hash-block-accumulator.cc
const uint8_t * BlockData ()
Retrievs the block buffer for writeback purposes.
Defined at line 39 of file ../../src/devices/block/drivers/block-verity/hash-block-accumulator.cc
bool HasWriteRequested ()
Accessor/mutator for bookkeeping a bit tracking whether we've attempted to
write this block (once filled) back to underlying storage yet.
Defined at line 41 of file ../../src/devices/block/drivers/block-verity/hash-block-accumulator.cc
void MarkWriteRequested ()
Defined at line 43 of file ../../src/devices/block/drivers/block-verity/hash-block-accumulator.cc