-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat: route commands to correct persistence service #9435
Conversation
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.
like the direction
@fgimenez for vis
9f2ae54
to
7083c5e
Compare
This is RFR now, merge conflicts resolved with recent tests, but the |
9a5f979
to
bc38020
Compare
// Write state and changesets to the database. | ||
// Must be written after blocks because of the receipt lookup. | ||
let execution_outcome = block.execution_outcome().clone(); | ||
execution_outcome.write_to_storage(&provider_rw, None, OriginalValuesKnown::No)?; |
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.
btw, I find this api a bit horrible cc @joshieDo
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 i agree, should be trait/type impl
noted
let static_file_service = | ||
StaticFileService::new(provider_factory, static_file_service_rx, database_handle); | ||
std::thread::Builder::new() | ||
.name("Static File Service".to_string()) | ||
.spawn(|| static_file_service.run()) | ||
.unwrap(); |
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.
hmm, why are those two separate threads?
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.
mainly for organization, but they could be combined
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.
Going to leave combining them into a followup, should not be hard
{ | ||
/// This is the main loop, that will listen to database events and perform the requested | ||
/// database actions | ||
pub fn run(mut self) { |
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.
Do we need a loop here? according to spawn_services
this run method is going to be run on a separate thread, not polled?
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.
yep, this will be handled by the while and sender is not expected to be dropped, nvm
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.
this has also made me realize that the current run loop implementation in EngineApiTreeHandlerImpl
was wrong, fixed it and updated the test here 0b100ee
feat: add spawning for the persistence task rm duplicate key fix compilation fix compilation again fix docs fix test receipts for single default block
Co-authored-by: Federico Gimenez <[email protected]> Co-authored-by: Matthias Seitz <[email protected]>
177ff25
to
f0e2538
Compare
going to merge this, and start working on some tests for existing code + scope out remaining work |
remaining work includes the "on reorg truncate static files" right? |
This refactors the persistence related services, renaming the
Persistence
service to the database service. This is because it mainly writes to the database. This also introduces a newPersistenceHandle
type, which sends to the static file or database service, depending on the command. This type should be used for consumers of the db / static file services.TODO: