-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add readonly iterators and support value mutations only from non-readonly iterators #345
Add readonly iterators and support value mutations only from non-readonly iterators #345
Conversation
This change: - Adds ReadOnly iterators that match current iterator API (except for the "ReadOnly" suffix added to some function names). - Refactors API of non-Readonly iterators because register inlining will require more parameters for MapIterator. For ReadOnly iterators, the caller is responsible for preventing changes to child containers during iteration because mutations of child containers are not guaranteed to persist. For non-ReadOnly iterators, two additional parameters are needed to update child container in parent map when child container is modified.
Is there are non-deterministic case there? |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## fxamacker/inline-array-and-map #345 +/- ##
==================================================================
+ Coverage 62.59% 62.62% +0.03%
==================================================================
Files 15 15
Lines 10492 10559 +67
==================================================================
+ Hits 6567 6613 +46
- Misses 2989 3004 +15
- Partials 936 942 +6
☔ View full report in Codecov by Sentry. |
Hi @bluesign, the readonly iterators will only be used internally in Cadence to reduce overhead. So "not guaranteed to persist" won't be a problem in this case. |
…omparator-and-hashinputprovider-to-mapiterator
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.
Nice!
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.
Great work!
I mainly reviewed the array and map code changes, I didn't look to deep into the tests
This PR:
Changes:
For readonly iterators, the caller is responsible for preventing changes to child containers during iteration because mutations of child containers are not guaranteed to persist.
For non-readonly iterators, two additional parameters are needed to update child container in parent map when child container is modified.
main
branchFiles changed
in the Github PR explorer