Skip to content

chore(lib/trie): LoadFromMap as function for transactional trie mutation #2875

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

Merged
merged 1 commit into from
Oct 11, 2022

Conversation

qdm12
Copy link
Contributor

@qdm12 qdm12 commented Oct 6, 2022

Changes

  • Trie mutation should be transactional/atomic as a method, in case an error occurs
  • Changed from method to function to avoid leaving a trie in a bad state
  • Function returns a new empty trie with all the key and value pairs given

This will become important for lazy loading where a disk write operation could fail for real.

Tests

go test -tags integration github.com/ChainSafe/gossamer/lib/trie/...

Issues

Related to #2838

Primary Reviewer

@jimjbrettj

@qdm12 qdm12 changed the title chore(lib/trie): LoadFromMap as function chore(lib/trie): LoadFromMap as function for transactional trie mutation Oct 6, 2022
@codecov
Copy link

codecov bot commented Oct 6, 2022

Codecov Report

Merging #2875 (46df10f) into development (736cbc8) will increase coverage by 0.24%.
The diff coverage is 52.47%.

Additional details and impacted files
@@               Coverage Diff               @@
##           development    #2875      +/-   ##
===============================================
+ Coverage        63.05%   63.30%   +0.24%     
===============================================
  Files              218      219       +1     
  Lines            27209    27357     +148     
===============================================
+ Hits             17157    17317     +160     
+ Misses            8469     8447      -22     
- Partials          1583     1593      +10     

Copy link
Contributor

@jimjbrettj jimjbrettj left a comment

Choose a reason for hiding this comment

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

great work!

- Trie mutation should be transactional/atomic as a method
- Changed from method to function to avoid leaving a trie in a bad state
- Function returns a new empty trie with all the key and value pairs given
@qdm12 qdm12 force-pushed the qdm12/trie/loadfrommap branch from e7c6116 to 46df10f Compare October 11, 2022 11:05
@qdm12 qdm12 merged commit 17517ea into development Oct 11, 2022
@qdm12 qdm12 deleted the qdm12/trie/loadfrommap branch October 11, 2022 11:38
EclesioMeloJunior pushed a commit that referenced this pull request Oct 12, 2022
…ation (#2875)

- Trie mutation should be transactional/atomic as a method, in case an error occurs
- Changed from method to function to avoid leaving a trie in a bad state
- Function returns a new empty trie with all the key and value pairs given
@github-actions
Copy link

🎉 This PR is included in version 0.7.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

3 participants