-
Notifications
You must be signed in to change notification settings - Fork 44
Stream blocks during import #1652
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
Conversation
Test Results 3 files ±0 43 suites ±0 8m 23s ⏱️ -1s Results for commit e32d61b. ± Comparison against base commit c0a7b67. This pull request removes 7 and adds 11 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
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.
It looks a bit more complicated to implement that what I expected and it probably means that we will have to handle the back pressure from the incoming stream to control memory consumption 🤔
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.
LGTM 👍, just a few suggestions.
mithril-common/src/cardano_block_scanner/immutable_block_streamer.rs
Outdated
Show resolved
Hide resolved
835021a
to
409530d
Compare
b72b1df
to
01df776
Compare
40224dd
to
73400cd
Compare
01df776
to
b0decd8
Compare
73400cd
to
d1ac13d
Compare
This trait define an 'async iterator' that can read blocks by chunks. The first implementation read them by chunks of ImmutableFiles.
So all types defined in it can be split to several files. + rework tests so they are specialized on the part they address: either the scanner or the streamer.
* Add a `DumbBlockStreamer` * Make the `DumbBlockScanner` returns the dumb streamer
Instead the streamer api is used to loaded them by chunks, right now those chunks are by immutable files but the API is agnostic to them and could be used with the chain sync protocol.
d1ac13d
to
5aab1d5
Compare
* Mithril-aggregator from `0.4.63` to `0.4.64` * Mithril-common from `0.3.34` to `0.3.35` * Mithril-signer from `0.2.127` to `0.2.128`
Content
This PR changes the way the blocks are retrieved from the
BlockScanner
. Instead of giving the full list of blocks from the given cardano database it yields now aBlockStreamer
trait that allow to poll the blocks at a pace given by it's implementation (theImmutableBlockStreamer
yield them immutables per immutables).This reduce the memory load needed during the import process.
The
BlockStreamer
trait has been designed with the transition to thechain_sync
protocol using pallas in mind. As such it sadly don't implement the rustIterator
trait since it needs to be async.Note: Since
mithril-common/src/cardano_block_scanner.rs
would become quite huge with the new types introduced, it has been promoted to a module directory instead and it's types spread out to dedicated files.Pre-submit checklist
Comments
This PR should be merged after #1650 since its branch is based on that PR code.
Issue(s)
Closes #1646