-
Notifications
You must be signed in to change notification settings - Fork 28
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
refactor(papyrus_storage): add append_events function that writes the events of a block to storage #2900
base: alonl/event_storage_split
Are you sure you want to change the base?
Conversation
Benchmark movements: |
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.
Reviewed 3 of 3 files at r3, all commit messages.
Reviewable status: 3 of 7 files reviewed, 4 unresolved discussions (waiting on @AlonLStarkWare)
crates/papyrus_storage/src/body/events.rs
line 377 at r3 (raw file):
DbCursor<'txn, RO, TransactionIndex, VersionZeroWrapper<TransactionMetadata>, SimpleTable>; /// interface for updating the events in the storage.
capitalization
crates/papyrus_storage/src/body/events.rs
line 382 at r3 (raw file):
Self: Sized, { /// Appends the events of an entire block to the storage.
Copy this comment:
sequencer/crates/papyrus_storage/src/class.rs
Line 118 in 34c98a0
// To enforce that no commit happen after a failure, we consume and return Self on success. |
crates/papyrus_storage/src/body/events.rs
line 386 at r3 (raw file):
self, block_number: BlockNumber, block_events: Vec<Vec<Event>>,
Receive this by reference and as an array slice and not a vec: &[&[Event]]
In general if you don't need to consume the value it's better to pass it by reference (as long as you don't clone it anywhere)
Also, in general it's better to receive &[T] instead of &Vec as the former can handle the latter yet also handle different stuff like arrays (You'll find that useful in tests for example)
crates/papyrus_storage/src/body/events.rs
line 425 at r3 (raw file):
for (index, transaction_events) in block_events.iter().enumerate() { let transaction_index = TransactionIndex(block_number, TransactionOffsetInBlock(index)); let event_offset = file_handlers.append_events(&transaction_events.clone());
Why clone?
ab03de4
to
63f915f
Compare
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.
Reviewable status: 0 of 7 files reviewed, 4 unresolved discussions (waiting on @ShahakShama)
crates/papyrus_storage/src/body/events.rs
line 377 at r3 (raw file):
Previously, ShahakShama wrote…
capitalization
Done.
crates/papyrus_storage/src/body/events.rs
line 382 at r3 (raw file):
Previously, ShahakShama wrote…
Copy this comment:
sequencer/crates/papyrus_storage/src/class.rs
Line 118 in 34c98a0
// To enforce that no commit happen after a failure, we consume and return Self on success.
Done.
crates/papyrus_storage/src/body/events.rs
line 386 at r3 (raw file):
Previously, ShahakShama wrote…
Receive this by reference and as an array slice and not a vec: &[&[Event]]
In general if you don't need to consume the value it's better to pass it by reference (as long as you don't clone it anywhere)
Also, in general it's better to receive &[T] instead of &Vec as the former can handle the latter yet also handle different stuff like arrays (You'll find that useful in tests for example)
Done.
crates/papyrus_storage/src/body/events.rs
line 425 at r3 (raw file):
Previously, ShahakShama wrote…
Why clone?
Done
63f915f
to
298f1b1
Compare
No description provided.