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
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
3e82b04
feat(file-storage): initialize library and binary
jmg-duarte May 15, 2024
d7d703c
feat(file-storage): start UnixFS implementation
jmg-duarte May 15, 2024
2333531
docs: update README
jmg-duarte May 16, 2024
124a11e
feat(file-storage): start implenting UnixFS chunking
jmg-duarte May 16, 2024
11667f1
feat(file-storage): implement CARv1 async reader and writer
jmg-duarte May 19, 2024
6e4f486
feat(file-storage): CARv2 reader & writer and CARv1 fixes
jmg-duarte May 20, 2024
6422e86
fix(file-storage): remove chunker
jmg-duarte May 21, 2024
ee26dec
fix(file-storage): unify Error
jmg-duarte May 21, 2024
e6874fb
feat(file-storage): index writer
jmg-duarte May 21, 2024
e3d19e2
fix(file-storage): Characteristics::new
jmg-duarte May 21, 2024
b2abf9a
style: cargo fix && cargo +nightly fmt
jmg-duarte May 21, 2024
db8aec3
fix: merge rustfmt.toml
jmg-duarte May 22, 2024
7c42c60
fix(file-storage): cid bug
jmg-duarte May 22, 2024
2455ff7
fix(file-storage): finish testing v2 writer
jmg-duarte May 22, 2024
3d01f47
feat(file-storage): move car library out of file-storage
jmg-duarte May 22, 2024
05103b7
fix(file-storage): car library API cleanup
jmg-duarte May 22, 2024
65e17ba
docs: fix intra-docs link
jmg-duarte May 22, 2024
f726a27
style: cargo fmt && cargo fix
jmg-duarte May 22, 2024
caf6fcd
style: taplo fmt
jmg-duarte May 22, 2024
4d96498
fix(file-storage): replace read_cid with Cid::read_bytes
jmg-duarte May 23, 2024
8279f93
fix(file-storage): reduce dependencies
jmg-duarte May 23, 2024
ae2ef61
docs: improve PRAGMA description
jmg-duarte May 23, 2024
6044ed8
fix(file-storage): add EMPTY default
jmg-duarte May 23, 2024
ef49447
fix(file-storage): error on invalid V1 headers
jmg-duarte May 23, 2024
6a35dac
fix(file-storage): further smooth the Error API
jmg-duarte May 23, 2024
9f63d2c
fix(file-storage): error on unknown characteristics
jmg-duarte May 23, 2024
71fcbc3
fix(file-storage): improve docstring and error message
jmg-duarte May 23, 2024
5ba4ca8
fix(file-storage): validate the incoming V2 pragma
jmg-duarte May 23, 2024
c8be17d
fix(file-storage): expose `ipld_core::cid::Cid`
jmg-duarte May 23, 2024
5306eab
docs(file-storage): improve v2::Reader docs
jmg-duarte May 23, 2024
a87a0f6
docs(file-storage): improve v1::Reader docs
jmg-duarte May 23, 2024
c1ab1a8
fix(file-storage): rename MultiWidthIndex (go-car name) to IndexSorte…
jmg-duarte May 23, 2024
9d41173
docs(file-storage): link cleaning
jmg-duarte May 23, 2024
7e6888b
fix(file-storage): broken tests
jmg-duarte May 23, 2024
5ea2564
docs: simplify intradoc links
jmg-duarte May 23, 2024
e1c27ac
fix(file-storage): add v1 roundtrip test
jmg-duarte May 23, 2024
ed35504
fix(file-storage): separate multicodec codes and add v2 roundtrip test
jmg-duarte May 23, 2024
7d5a180
fix(file-storage): make use of PbLink
jmg-duarte May 23, 2024
5c3c568
feat(file-storage): add padding support to v2 writer
jmg-duarte May 23, 2024
3b7109a
chore: reset the file-storage folder
jmg-duarte May 24, 2024
3706d03
fix(file-storage): make generate_multihash available to the rest of t…
jmg-duarte May 24, 2024
34fa1ba
feat(file-storage): add balanced tree
jmg-duarte May 27, 2024
6828e27
fix(file-storage): go-car compliance
jmg-duarte May 28, 2024
f94ede6
style: cargo fix
jmg-duarte May 28, 2024
fe7816e
fix(file-storage): clean up
jmg-duarte May 28, 2024
deb3bfd
feat(file-storage): add blockstore
jmg-duarte May 28, 2024
09626d0
fix: remove unused parameter from `Block` and by consequence `Block` …
jmg-duarte May 28, 2024
55639dc
tests: add stream_balanced_tree tests
jmg-duarte May 28, 2024
adde8c0
fix: clean up, docs and cruft like that
jmg-duarte May 28, 2024
3ff72e4
chore: reduce tokio features
jmg-duarte May 28, 2024
8a9197d
fix: remove debug dump
jmg-duarte May 28, 2024
5c2a5a2
tests: shorten the spaceglenda test
jmg-duarte May 28, 2024
333c9ec
style: cargo fmt
jmg-duarte May 28, 2024
e1d744b
fix: handle TODOs
jmg-duarte May 29, 2024
6fc7fdc
docs: improve mater/README.md
jmg-duarte May 31, 2024
b1acae1
fix: replace magic constant
jmg-duarte May 31, 2024
9752818
fix: const a cheating value
jmg-duarte May 31, 2024
ec180a9
docs: better Blockstore::read
jmg-duarte May 31, 2024
5fc51d6
docs: better explanation on the pin + peekable combo
jmg-duarte May 31, 2024
1de6fde
chore: remove discussed notes
jmg-duarte May 31, 2024
dcec85f
docs: improve blockstore description
jmg-duarte May 31, 2024
e43ff4b
chore: Cargo.lock update
jmg-duarte May 31, 2024
575f23f
Merge branch 'develop' into feat/25/car-implementation
jmg-duarte May 31, 2024
9d7f362
style: format Cargo
jmg-duarte May 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
edition = "2021"
group_imports = "StdExternalCrate"
hard_tabs = false
imports_granularity = "Crate"
tab_spaces = 4
103 changes: 102 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 18 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license-file = "LICENSE"
repository = "https://github.com/eigerco/polka-storage"

[workspace]
members = ["node", "runtime", "storage/polka-index"]
members = ["node", "runtime", "storage/mater", "storage/polka-index"]
resolver = "2"

# FIXME(#@jmg-duarte,#7,14/5/24): remove the patch once something >1.11.0 is released
Expand All @@ -28,30 +28,47 @@ panic = 'abort' # Use abort on panic to reduce binary size
substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.11.0" }
substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.11.0" }

async-stream = "0.3.5"
bitflags = "2.5.0"
byteorder = "1.5.0"
bytes = "1.6.0"
ciborium = "0.2.2"
cid = { version = "0.11.1" }
clap = { version = "4.5.3" }
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
color-print = "0.3.4"
digest = "0.10.7"
th7nder marked this conversation as resolved.
Show resolved Hide resolved
futures = "0.3.28"
hex-literal = { version = "0.4.1" }
indexmap = "2.2.6"
integer-encoding = "4.0.0"
ipld-core = "0.4.1"
ipld-dagpb = "0.2.1"
jmg-duarte marked this conversation as resolved.
Show resolved Hide resolved
itertools = "0.13.0"
jsonrpsee = { version = "0.22" }
log = { version = "0.4.21", default-features = false }
polkavm = "0.9.3"
polkavm-derive = "0.9.1"
polkavm-linker = "0.9.2"
quick-protobuf = "0.8.1"
jmg-duarte marked this conversation as resolved.
Show resolved Hide resolved
quote = { version = "1.0.33" }
rand = "0.8.5"
rocksdb = { version = "0.21" }
scale-info = { version = "2.11.1", default-features = false }
serde = { version = "1.0.197", default-features = false }
serde-big-array = { version = "0.3.2" }
serde_derive = { version = "1.0.117" }
serde_ipld_dagcbor = "0.6.1"
serde_json = { version = "1.0.114", default-features = false }
serde_yaml = { version = "0.9" }
sha2 = "0.10.8"
smallvec = "1.11.0"
syn = { version = "2.0.53" }
tempfile = "3.10.1"
thiserror = { version = "1.0.48" }
tokio = "1.37.0"
jmg-duarte marked this conversation as resolved.
Show resolved Hide resolved
tokio-stream = "0.1.15"
tokio-util = "0.7.11"
tracing-subscriber = { version = "0.3.18" }

# Local
Expand Down
2 changes: 0 additions & 2 deletions rustfmt.toml

This file was deleted.

35 changes: 35 additions & 0 deletions storage/mater/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[package]
authors.workspace = true
edition.workspace = true
homepage.workspace = true
license-file.workspace = true
name = "mater" # name WIP
jmg-duarte marked this conversation as resolved.
Show resolved Hide resolved
repository.workspace = true
version = "0.1.0"

[dependencies]
async-stream.workspace = true
bitflags.workspace = true
byteorder = { workspace = true, features = ["i128"] }
bytes.workspace = true
digest.workspace = true
futures.workspace = true
indexmap.workspace = true
jmg-duarte marked this conversation as resolved.
Show resolved Hide resolved
integer-encoding = { workspace = true, features = ["tokio_async"] }
ipld-core = { workspace = true, features = ["serde"] }
ipld-dagpb.workspace = true
quick-protobuf.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_ipld_dagcbor.workspace = true
sha2.workspace = true
thiserror.workspace = true
tokio = { workspace = true, features = ["fs", "macros", "rt"] }
tokio-stream.workspace = true
tokio-util = { workspace = true, features = ["io"] }

[dev-dependencies]
rand.workspace = true


[lints]
workspace = true
29 changes: 29 additions & 0 deletions storage/mater/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Mater

A Rust library to read and write CAR files.

This library is based on [beetle](https://github.com/n0-computer/beetle).

## Specifications

CARv1 specification: https://ipld.io/specs/transport/car/carv1/
CARv2 specification: https://ipld.io/specs/transport/car/carv2/
UnixFS specification: https://github.com/ipfs/specs/blob/e4e5754ad4a4bfbb2ebe63f4c27631f573703de0/UNIXFS.md

## Developing

### Overview

This crate is composed of three main modules:

- `unixfs/` — which covers the main UnixFS abstractions
- `v1/` — which contains the CARv1 implementation and respective abstractions
- `v2/` — which contains the CARv2 implementation and respective abstractions

### Further notes

The [`unixfs_pb.rs`](src/unixfs/unixfs_pb.rs) was automatically generated using
[`pb-rs`](https://github.com/tafia/quick-protobuf/tree/master/pb-rs).
The file was generated and checked-in instead of making `pb-rs` part of the build
because the definition file ([`unixfs.proto`](src/unixfs/unixfs.proto)) does not
change frequently, hence, there is no need to add complexity to the build process.
Loading