$before
$before : ?\Drupal\strata\File\FileMap
What changed between two versions of a file, block by block.
The thing that decides what a new version costs. A version whose blocks are already in the store costs a map and nothing else; one with thirty-three new blocks costs those blocks.
Two counts, and they answer different questions. The blocks at changed POSITIONS say how much of the file looks different, which is what tells a shift from an edit. The blocks that are genuinely NEW say what has to be uploaded, and it is always the smaller number - a shifted file is full of blocks that moved rather than changed, and a moved block is already stored.
$before : ?\Drupal\strata\File\FileMap
$after : \Drupal\strata\File\FileMap
__construct(\Drupal\strata\File\FileMap|null $before, \Drupal\strata\File\FileMap $after, list$changedPositions, list $newBlocks, list $droppedBlocks) : mixed
Constructs a diff.
| \Drupal\strata\File\FileMap|null | $before | The previous version, or NULL for a first capture. |
| \Drupal\strata\File\FileMap | $after | The version being stored. |
| list |
$changedPositions | Block indexes whose content differs from the same index in the previous version, plus every index past the end of it. |
| list |
$newBlocks | Block addresses the previous version did not contain anywhere, in first-seen order. |
| list |
$droppedBlocks | Block addresses the previous version contained and this one does not. |
between(\Drupal\strata\File\FileMap|null $before, \Drupal\strata\File\FileMap $after) : \Drupal\strata\File\FileMapDiff
Compares two versions of a file.
| \Drupal\strata\File\FileMap|null | $before | The previous version, or NULL for a first capture, which reports every block as new. |
| \Drupal\strata\File\FileMap | $after | The version being stored. |
When the two maps were split at different block sizes, which would make every position comparison meaningless. Recapturing the file at the new size is the answer, and saying so beats reporting a 100% change as though the file had been rewritten.
The diff.
changedRatio() : float
Share of the file's positions whose content differs.
The number a shift is detected from. Measured on a 256 MiB file: a 2 MiB in-place edit moves 0.81% of it, and a 2 MiB insertion moves 60.79%.
A fraction between 0 and 1. A first capture is 1.0, since none of it was there before.