-
Notifications
You must be signed in to change notification settings - Fork 195
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
base: main
Are you sure you want to change the base?
Streaming repo parsing #1000
Conversation
repo/repo.go
Outdated
@@ -97,6 +107,8 @@ func IngestRepo(ctx context.Context, bs cbor.IpldBlockstore, r io.Reader) (cid.C | |||
} | |||
} | |||
|
|||
bufrPool.Put(bufr) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
bfa8774
to
279d668
Compare
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