Closed xlc closed 4 years ago
Duplicate of https://github.com/paritytech/substrate/issues/4610
It is more of follow up of #4610 that can happen independently.
I don't see where does #4610 specify how the iterating API going to look like. This is a blocking issue for us and I would like to fix it myself with help from your guys, but I don't want to do #4610 because it is a lot of work to migrate all storages.
It is not written there explicitly, you are right. However the goal of the issue to also have some api to do the iteration easily.
If you want to do that now, you can just use sp_io::storage::next_key
to do the iteration manually. That should resolve your blocker for now.
Currently
StoragePrefixedMap::iter
can be used to iterate values, but I would like to iterate with keys as well.We would probably want a version iterate with raw keys (for
blake2_256
hasher) and a version iterate with decoded value (fortwox_64_concat
/blake2_128_concat
).Not sure what is the best API, but a raw key version can be a good starter.
I can do this but unsure what to call the new method.
Should I make
iter
always returns raw key and values? (breaking change) Or add a newiter_with_raw_key
? Please suggest a better name Oriter(key_decoder: KeyDecoder)
?