-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement API to allow replacing root CIDs in a CARv1 or CARv2 #250
Conversation
I think having it take a path on disk is fair - we only exposed And if we want to later on expose a |
That was my thought too. I think we probably need both: Basic APIs to work with CAR files, and equivalent functionality used through blockstore. I think we have a separate ticket already for blockstore support: #196 |
Yep agreed. Was just thinking outloud :) |
286f959
to
c8f7529
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could potentially get rid of the comment saying it doesn't shift padding - i'd prefer that to show up in this method once supported, rather than maintaining two different exposed APIs for it.
Implement an API that allows a caller to replace root CIDs in an existing CAR file, may it be v1 or v2, as long as the resulting serialized header is of identical size to the existing header. Assert that the new API works in a variety of CARv1 and CARv2 files along with failure scenarios. Fixes #245
c8f7529
to
f95f29c
Compare
My only worry is that it would end up being an API that might be very cheap (just rewrite the first kilobyte of data) versus very expensive (copy potentially gigabytes of data, depending on how large the CAR is). |
I think what Will is taking about is to use the padding after CARv2 header, before inner CARv1 to grow roots when needed. That should still be cheap for CARv2 files and it just means So we could expand the implementation to support replacing larger roots as long as they fit into the padding+current v1 header size |
Ah, that's fair. As long as it's equally cheap :) |
Implement an API that allows a caller to replace root CIDs in an
existing CAR file, may it be v1 or v2, as long as the resulting
serialized header is of identical size to the existing header.
Assert that the new API works in a variety of CARv1 and CARv2 files
along with failure scenarios.
Fixes #245