Skip to content
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

Define CAR v2 fixed prefix and header #80

Merged
merged 4 commits into from
Jun 11, 2021
Merged

Define CAR v2 fixed prefix and header #80

merged 4 commits into from
Jun 11, 2021

Conversation

masih
Copy link
Member

@masih masih commented Jun 10, 2021

Define the magic CAR v2 prefix proposed in ipld/specs#248 and assert
that it remains a valid CAR v1 header, along with other tests that
verify the expected length, content and version number.

Define basic structs to represent CAR v2 header, along with placeholder
for the future "characteristics" bitfield, and the optional padding
between CAR v1 dump and index added to the end of a CAR v2 archive.

Relates to ipld/specs#248 (comment)

@masih masih added the kind/enhancement A net-new feature or improvement to an existing feature label Jun 10, 2021
@masih masih self-assigned this Jun 10, 2021
Define the magic CAR v2 prefix proposed in ipld/specs#248 and assert
that it remains a valid CAR v1 header, along with other tests that
verify the expected length, content and version number.

Define basic structs to represent CAR v2 header, along with placeholder
for the future "characteristics" bitfield, and the optional padding
between CAR v1 dump and index added to the end of a CAR v2 archive.

Relates to:
- ipld/specs#248 (comment)
@masih masih marked this pull request as ready for review June 10, 2021 12:01
@masih masih requested review from mvdan, rvagg and willscott June 10, 2021 12:01
v2/car.go Show resolved Hide resolved
v2/car.go Outdated Show resolved Hide resolved
Reflecting on PR review comments, no harm in exposing this and it may be
useful to the users of the library.
Reflecting on the review comment, adding this field could provide
optimisation opportunities in the future in the context of block
alignment.

See:
- https://github.com/ipld/go-car/pull/80/files#r649241583
Now that the `CarV1Offset` is added to the header, the size is increased
from `32` to `40` bytes. Make it so in the test case name.
Copy link
Member

@rvagg rvagg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, I especially like the TestCarV2PrefixIsValidCarV1Header in here to tie it in to v1

@masih masih merged commit 968459c into ipld:wip/v2 Jun 11, 2021
@masih masih deleted the prefix-header branch June 11, 2021 07:32
@masih masih added this to the CAR v2 milestone Jun 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A net-new feature or improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants