Skip to main content

CONNECTIVITY_BUDGET

Constant CONNECTIVITY_BUDGET 

Source
pub const CONNECTIVITY_BUDGET: usize = 64_000_000;
Expand description

The ceiling on objects visited by receive-pack’s connectivity check.

§Why this is not DEFAULT_BUDGET, which would be one constant

Because they bound two different quantities, and one implementation is about not writing the same thing twice rather than about giving two things one name. A fetch’s budget stands in front of everything the server is about to materialise: several repository-sized id vectors and then the pack itself. This walk materialises nothing — since the one-walk fix it holds exactly one repository-sized [OidSet], the seen set, because [verify_connectivity] tallies its output instead of collecting it — and it runs over objects the server has already received and indexed, whose size gunnar_pack::IndexOptions bounded on the way in. A push has therefore already paid its admission by the time this runs; a fetch has not.

Sixty-four million is 4.6x the kernel’s 13 816 503 objects. At sha1 the one set costs ~25 bytes per id held, so a walk that genuinely reached this ceiling would hold ~1.6 GB — a bound, and an honest one for a machine that is asked to accept a kernel-sized mirror push at all.