-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
Few things I need help improving here:
|
about raised issue, the whole thing is that we would want to get rid of the generator (which were only useful for decl_storage), in order to implement the traits StorageMap directly. some idea were given in another context here #8605 (comment) |
Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com> Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>
} | ||
|
||
/// Remove all value of the storage. | ||
pub fn remove_all() { |
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.
if we want to support limit, then we need sp-io to return the number of deleted key in the overlay, once merged I will open an issue, and we can work on it when we need it.
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 not already covered here?
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.
the new API doesn't say about how many value are removed from the overlay, without this information it is not possible to update the counter efficiently
superseeded by #9125 for proper review approvals |
This PR introduces a new Storage abstraction:
CountedStorageMap
The
CountedStorageMap
is a simple wrapper around aStorageMap
andStorageValue<u32>
which keeps count of the number of items in the map by using the value as a counter.