Skip to content

Streaming repo parsing #1000

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

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open

Streaming repo parsing #1000

wants to merge 23 commits into from

Conversation

whyrusleeping
Copy link
Collaborator

First pass at a streaming repo parse utility. This iterates the repo in mst order, waiting for the blocks it needs to be read from the passed in stream.

It currently doesnt have a good backpressure mechanism, will need to add that next. I kinda wanted to get this to be a generator pattern type thing instead of using goroutines, but since the blocks can be reordered it gets sticky... we will see

repo/repo.go Outdated
@@ -97,6 +107,8 @@ func IngestRepo(ctx context.Context, bs cbor.IpldBlockstore, r io.Reader) (cid.C
}
}

bufrPool.Put(bufr)
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if the function returns before this line? Do we need to defer putting the buffer back in the pool?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah deferring the put probably makes sense, in general its not a huge deal if we miss putting something back in the pool in an error case, but this isnt inconvenient

@whyrusleeping whyrusleeping force-pushed the feat/stream-repo-parse branch from bfa8774 to 279d668 Compare May 2, 2025 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants