-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[framework] Adding utilities to OrderedMap / BigOrderedMap #15810
Conversation
⏱️ 10m total CI duration on this PR
|
// Use new_with_type_size_hints or new_with_config if your types have variable sizes. | ||
assert!( | ||
bcs::constant_serialized_size<K>().is_some() && bcs::constant_serialized_size<V>().is_some(), | ||
error::invalid_argument(EINVALID_CONFIG_PARAMETER) |
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.
not sure if it is better to allow new() for all types - and then if first values inserted are not representative - by a factor of 100x+ - not being able to insert bigger values later.
or as implemented here - be conservative - and ask people to intentionally provide or not provide size hints.
|
||
/// Returns the number of elements in the BigOrderedMap. | ||
/// This is an expensive function, as it goes through all the leaves to compute it. | ||
public fun compute_length<K: store, V: store>(self: &BigOrderedMap<K, V>): u64 { |
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.
intentionally not calling length() because it is expensive to call. Is that reasonable?
b12b063
to
9dbe637
Compare
@@ -349,7 +397,7 @@ module aptos_std::ordered_map { | |||
} | |||
|
|||
/// Returns whether the iterator is a begin iterator. | |||
public fun iter_is_begin<K, V>(self: &IteratorPtr, map: &OrderedMap<K, V>): bool { | |||
public(friend) fun iter_is_begin<K, V>(self: &IteratorPtr, map: &OrderedMap<K, V>): bool { |
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.
Is this intentional?
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.
yes! I've patched this in 1.26 already. iter* should all be public friend, until references are available in move
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.
Otherwise LGTM
9dbe637
to
8b276ea
Compare
8b276ea
to
9372017
Compare
making traversal APIs complete and public adding ordering-based utilities, without iterator functionality
9372017
to
53c9d4e
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
making traversal APIs complete and public
adding ordering-based utilities, without iterator functionality
Description
How Has This Been Tested?
Key Areas to Review
Type of Change
Which Components or Systems Does This Change Impact?
Checklist