VERSION
VERSION = 1
Format marker, so a future change is a new version rather than a silent misread.
One version of one file, as the ordered list of blocks that rebuild it.
This is what a file version costs to store: a few dozen bytes per block rather than the blocks themselves, since the blocks are content-addressed and shared with every other version that contains them. A 256 MiB file is 4,096 blocks, so its map is about 270 KiB of digests - and the second version of the same file with a 2 MiB edit stores a second map plus the 33 blocks that changed.
The order matters and is the whole point: the same blocks in a different order are a different file. So a map is a list, never a set, and its own address covers the order.
__construct(string $path, list$blocks, int $length, int $blockSize = \Drupal\strata\File\BlockSplitter::DEFAULT_SIZE, int $capturedAt = 0) : mixed
Constructs a map.
| string | $path | The file's path, relative to whatever root the capture walked. |
| list |
$blocks | Block content addresses, in file order. |
| int | $length | The file's length in bytes. |
| int | $blockSize | The block size the map was split at, recorded because a map split at one size cannot be compared with one split at another and a reader has to be able to tell. |
| int | $capturedAt | Unix seconds. |
When the path is empty, a block is not a digest, or the length disagrees with the block count.
distinct() : list<string>
The distinct blocks the file is made of.
A file with a long run of identical content - a sparse image, a padded archive - has far fewer distinct blocks than blocks, and only the distinct ones are stored.
Block addresses, deduplicated, in first-seen order.