gix-pack: provide access to index-less parallel pack traversal (cache::delta::Tree) #2922
Roberto Di Cosmo (rdicosmo)
started this conversation in
Feature Proposal
Replies: 1 comment 1 reply
|
I will keep it short as I think I talk to Claude here, which if I were would be violating the contribution guidelines that requires clear separation of speech.
|
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
gix-packalready has the machinery to resolve the objects of a self-contained pack in parallel directly from a header scan: build acache::delta::Treeand callTree::traverse(). This is essentially the path used internally byindex::File::traverse_with_index().Since
cache::deltaispub(crate)this path cannot currently be used outside the crate.This is precious functionality for our use case (and possibly more), and I am requesting advice on how to proceed to get a public way to access it.
The use case
At Software Heritage we work on archiving and deduplicating source code at scale. We fetch packfiles from very large numbers of repositories and, for each freshly fetched self-contained, non-thin pack (ofs-delta), need to walk the pack once to compute content hashes and convert the objects. Since the packs are self-contained and we recompute and check object hashes downstream, we do not need a verified traversal, and building a complete
.idxjust to traverse the pack is unnecessary.This matters at our scale: Linux-sized repositories are around 13.5M objects, Chromium around 28M, and we process millions of packs. Avoiding a complete intermediate index construction avoids significant waste of resources.
The entry graph can already be built directly from the pack header scan, by pack offset, which is precisely what the existing
gitoxidetraversal machinery does internally.We just need a supported way to access this machinery.
Possible API shape
The apparently simple approach, pub mod delta, seems too broad: it exposes ~20 internal items, creates a documentation burden with
#![deny(missing_docs)], and unnecessarily makes those internals part of the public API.The smallest change I found would be a facade re-export of just what the caller needs:
pub use delta::{Tree, traverse::{Context, Options}};Those three items are already documented, while delta itself can remain pub(crate).
But I seeat least two reasons why you may prefer something narrower:
The ask
We are not attached to any particulr API shape, what we need is the capability: build the delta dependency tree directly from a streaming pack header scan and resolve it in parallel, without first materialising an index.
Which approach makes sense for you? Once the decision is make on your side, I'm happy to prepare the PR, including a small doc-test anchoring the index-less traversal path.
All reactions