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

Implement balance table #285

Merged
merged 6 commits into from
Mar 19, 2020
Merged

Implement balance table #285

merged 6 commits into from
Mar 19, 2020

Conversation

austinabell
Copy link
Contributor

Summary of changes
Changes introduced in this pull request:

  • Implements balance table, which is needed for market and power actors to more easily match spec
  • Adds a for_each function on the hamt, which allows passing a function which reads kvs and performs the function on all of them while mutating state outside of the function.
  • Update TokenAmount traits for more clean usage

Reference issue to close (if applicable)

Closes #278

Other information and links

@austinabell austinabell changed the title Austin/actor/balancetable Implement balance table Mar 18, 2020
/// assert_eq!(total, 3);
/// ```
#[inline]
pub fn for_each<F, V>(&self, f: &mut F) -> Result<(), String>
Copy link
Member

Choose a reason for hiding this comment

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

couldn't impl the Iterator trait instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no because all of the elements are not in memory. Also this would be done on top of this, the reason for this is to be able to more closely match the spec.

@@ -129,6 +128,29 @@ where
self.pointers.is_empty()
}

pub(crate) fn for_each<V, S, F>(&self, store: &S, f: &mut F) -> Result<(), String>
Copy link
Member

Choose a reason for hiding this comment

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

couldn't impl the Iterator trait instead?

@austinabell austinabell merged commit 7671255 into master Mar 19, 2020
@austinabell austinabell deleted the austin/actor/balancetable branch March 19, 2020 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement balance table
3 participants