Refactor push rules to allow for bulk checks
What does this MR do?
The FileSizeCheck push rule loads all new blobs for a given change and checks whether any of these blobs is bigger than a certain threshold. This push rule is quite expensive: loading new blobs requires a revwalk of all preexisting references and thus scales with the number of refs in a repository. This may easily take a few dozen seconds to compute, and repeating this computation for each change doesn't help either.
This merge requests refactors our PushRulesChecks to allow for batched access checks. Basically, it's converted from a BaseSingleChecker to a BaseBulkChecker, where it then creates SingleChangeAccesses on the fly for all of its subchecks.
This allows us to easily change the FileSizeCheck to be a batched check, too. Except for laying the groundworks, this MR doesn't yet do anything and thus shouldn't cause any change in behaviour. I'll have to create a separate MR first to refactor our interfaces to load blobs from Gitaly.
Part of #336761 (closed)
Does this MR meet the acceptance criteria?
Conformity
-
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides. -
This change is backwards compatible across updates, or this does not apply.
Availability and Testing
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.)