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

CAR Reader for supporting carlet #4

Open
LucRoy opened this issue Jul 10, 2023 · 1 comment
Open

CAR Reader for supporting carlet #4

LucRoy opened this issue Jul 10, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@LucRoy
Copy link

LucRoy commented Jul 10, 2023

*** Encloud Specific ***

  1. encloud are using Anelace + Carlet for data prep and with this we generate CAR files and splits without a root cid

  2. Currently on edge and delta the add-car endpoint is being developed and it will be designed to handle CAR files in the format as prepared by go-car, i.e., with a root cid

  3. Additionally, we had a discussion around whether the response from edge for getting a CAR file should return the raw bytes or a CAR file. For our use case we want the raw bytes to be returned. For this I understand we need to write a special reader, that we discussed about potentially co developing.

@LucRoy LucRoy self-assigned this Jul 10, 2023
@LucRoy LucRoy added the enhancement New feature or request label Jul 10, 2023
@alvin-reyes
Copy link

@LucRoy

You can use the following:

// gocarv2 package
car, err := gocarv2.NewBlockReader(file)

// do for loop to read the blocks (don't read the roots)

buf := new(bytes.Buffer)
for {
    block, err := car.Next()
   _, err = io.Copy(buf, bytes.NewReader(    block.RawData()))
   // return the buf that has all the block raw data
} 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants