Support replacing Roots in CAR file as long as they fit within padding + existing header size
- Dominant language
- Go
- Stars
- 175
- Forks
- 54
- Avg merge
- 6d 5h
- Merged PRs (30d)
- 4
Description
go-car/v2 offers an API to [replace root CIDs](https://github.com/ipld/go-car/blob/f4378127a67f1bf4d616ef83a1e5a4d841a9478b/v2/writer.go#L222) in the inner CARv1 as long as the replacement does not change the size of inner CARv1 header. This is to provide a cheap way to swap root CIDs without having to shift the inner CARv1 sections since they can be quite large.
CARv2 supports optional padding before the data payload. That function can accept replacement roots of different size as long as they fit within the Toal size of padding + current inner CARv1 header.
For example, if the replacements are smaller than existing it would expand the padding. Similarly, when the replacements are larger it would take off the padding needed to fit the new inner CARv1 header. It would then update the CARv2 header with a corrected data offset.
Relates to:
* https://github.com/ipld/go-car/pull/250#issuecomment-932094890
* #245
Contributor guide
No contributing guide indexed for this repository
Research direction
The existing root-CID replacement entry point is in v2/writer.go, linked around line 222; read that implementation and the CARv2 padding and header handling first. Check the behavior against this issue and related #245 and PR #250: padding should absorb smaller headers or be consumed for larger ones, with the data offset corrected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- data
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100