Skip to content
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

Correct the get_mut and get_mut_or_default for ByteMapView #2238

Merged
merged 14 commits into from
Jul 15, 2024

Conversation

MathieuDutSik
Copy link
Contributor

Motivation

For those two functions, the deleted_prefixes were not handled which is a mistake.

Proposal

While being at that some other things were done:

  • The .unwrap() were replaced by ? and the use of Result<()> or similar.
  • The random tests were grouped in the same file which allow to take advantage of the parallelism of the tests and a little faster CI.
  • The API of get_mut and similar functions in CollectionView/ ReentrantCollectionView was changed so that it now takes a &[u8] instead of Vec<u8> for simplicity.
  • The helper function load_value was eliminated.

Test Plan

A specific test that repro

Release Plan

The internal documentation of the functions was changed to reflect the new API.

Links

@MathieuDutSik MathieuDutSik marked this pull request as ready for review July 12, 2024 14:12
Copy link
Contributor

@ma2bd ma2bd left a comment

Choose a reason for hiding this comment

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

Thanks for the fix. I'm assuming that only get_mut and get_mut_or_default are changed meaningfully

linera-views/src/map_view.rs Show resolved Hide resolved
linera-views/src/map_view.rs Outdated Show resolved Hide resolved
};
Ok(match update {
None => None,
Some(update) => match update {
Copy link
Contributor

@ma2bd ma2bd Jul 15, 2024

Choose a reason for hiding this comment

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

nit: Some(Update::Removed) => None etc to avoid nested matches (the compiler will re-optimize)

@MathieuDutSik MathieuDutSik merged commit f59ad4d into linera-io:main Jul 15, 2024
6 checks passed
@MathieuDutSik MathieuDutSik deleted the map_view_correct branch July 22, 2024 07:32
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