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

CARv2 implementation #29

Merged
merged 64 commits into from
May 31, 2024
Merged

CARv2 implementation #29

merged 64 commits into from
May 31, 2024

Conversation

jmg-duarte
Copy link
Contributor

@jmg-duarte jmg-duarte commented May 20, 2024

Description

Add a CARv2 reader and writer along with a basic block store as an higher-level interface to the writer.

Further development is required to make the interfaces more usable but that can, and should, be informed by usage needs.

Important points for reviewers

Specifications

Design based on

Couldn't simply take it into our system as not only the libraries are no longer maintained, they're also dependent on other components that we don't care about.

Checklist

  • Are there important points that reviewers should know?
    • If yes, which ones?
  • Make sure that you described what this change does.
  • If there are follow-ups, have you created issues for them?
    • If yes, which ones? / List them here
  • Have you tested this solution?
  • Were there any alternative implementations considered?
  • Did you document new (or modified) APIs?

fixes #25

Copy link
Contributor

@serg-temchenko serg-temchenko left a comment

Choose a reason for hiding this comment

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

After a high-level overview, I have some questions about the layer at which this implementation should be. Right now, it is under the binary crate file-storage, but I thought that the car implementation is abstract enough to be in a more low-level implementation, such as a library, rather than a binary, so we could at some point publish it on the crates.io. Additionally, the public API is not clear to me; it only exposes the generate_multihash function and the MultihashCode trait in mod.rs.

Overall, the layers are mixed and the scope is a bit broken here, as we have a separate task for the polka-storage crate implementation here.

Perhaps it's my fault that we didn't discuss this properly before implementation. Sorry about that.

storage/file-storage/src/car/mod.rs Outdated Show resolved Hide resolved
@jmg-duarte
Copy link
Contributor Author

After a high-level overview, I have some questions about the layer at which this implementation should be. Right now, it is under the binary crate file-storage, but I thought that the car implementation is abstract enough to be in a more low-level implementation, such as a library, rather than a binary, so we could at some point publish it on the crates.io.

Agreed, I just moved it under file-storage because there was no guide under the parachain implementations on division and I err'd on keeping it under one roof. I'll move it out.

About the public API, it's still not finished, hence looking a bit quirky.

@jmg-duarte jmg-duarte self-assigned this May 22, 2024
Copy link
Member

@cernicc cernicc 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 imagine this took a lot of work. I left some comments and questions :D

storage/file-storage/Cargo.toml Outdated Show resolved Hide resolved
storage/file-storage/src/car/mod.rs Outdated Show resolved Hide resolved
storage/file-storage/src/car/v1/reader.rs Outdated Show resolved Hide resolved
storage/file-storage/src/car/v1/reader.rs Outdated Show resolved Hide resolved
storage/file-storage/src/car/v2/mod.rs Outdated Show resolved Hide resolved
storage/file-storage/src/car/v1/reader.rs Outdated Show resolved Hide resolved
storage/file-storage/src/car/v1/reader.rs Outdated Show resolved Hide resolved
storage/file-storage/src/car/v2/reader.rs Outdated Show resolved Hide resolved
storage/file-storage/src/car/v2/mod.rs Outdated Show resolved Hide resolved
storage/file-storage/src/car/v2/reader.rs Outdated Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
jmg-duarte added 24 commits May 28, 2024 16:14
some CARv1 fixes depended on the CARv2, others were found during
development, since v2 depends on v1, it's hard to keep them decoupled
They may come back for the UnixFS or other features
Previously, the `read_header` function would trust that the caller knew what they were doing. It no longer does that.
@serg-temchenko serg-temchenko added ready for review Review is needed and removed ready for review Review is needed labels May 31, 2024
serg-temchenko
serg-temchenko previously approved these changes May 31, 2024
Copy link
Contributor

@serg-temchenko serg-temchenko left a comment

Choose a reason for hiding this comment

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

Huge 🔥 Thanks @jmg-duarte!

storage/mater/src/lib.rs Outdated Show resolved Hide resolved
storage/mater/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@th7nder th7nder left a comment

Choose a reason for hiding this comment

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

I didn't go through it all, but it's a piece of great work mate! All I have are questions/minor comments.

Cargo.toml Show resolved Hide resolved
Cargo.toml Show resolved Hide resolved
Cargo.toml Show resolved Hide resolved
Cargo.toml Show resolved Hide resolved
storage/mater/Cargo.toml Show resolved Hide resolved
storage/mater/src/blockstore.rs Outdated Show resolved Hide resolved
storage/mater/src/blockstore.rs Show resolved Hide resolved
storage/mater/src/blockstore.rs Outdated Show resolved Hide resolved
storage/mater/src/blockstore.rs Outdated Show resolved Hide resolved
storage/mater/src/lib.rs Outdated Show resolved Hide resolved
@jmg-duarte jmg-duarte dismissed stale reviews from serg-temchenko and cernicc via dcec85f May 31, 2024 09:19
@jmg-duarte jmg-duarte requested a review from th7nder May 31, 2024 09:26
th7nder
th7nder previously approved these changes May 31, 2024
Copy link
Contributor

@th7nder th7nder left a comment

Choose a reason for hiding this comment

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

🚀 🚀

@jmg-duarte jmg-duarte requested a review from cernicc May 31, 2024 10:10
@serg-temchenko serg-temchenko added ready for review Review is needed and removed ready for review Review is needed labels May 31, 2024
@serg-temchenko
Copy link
Contributor

@jmg-duarte please check the CI.

@jmg-duarte jmg-duarte added ready for review Review is needed and removed ready for review Review is needed labels May 31, 2024
@jmg-duarte jmg-duarte requested a review from serg-temchenko May 31, 2024 13:05
@serg-temchenko serg-temchenko merged commit 9384b7a into develop May 31, 2024
3 checks passed
@serg-temchenko serg-temchenko deleted the feat/25/car-implementation branch May 31, 2024 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review Review is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CARv2 Implementation
4 participants