You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when accessing storage maps (ie storage entries that require some key to be provided) we have two options:
// 1. provide _all_ of the keys to get a single value back:
runtime::storage().pallet().entry(key1, key2, ...);// 2. provided no keys. This allows iterating over _everything_:
runtime::storage().pallet().entry_root();
When more than one key is needed, it'd be nice if people could provide any subset of the required keys to be able to iterate over all of the remaining values. In other words it'd be nice if the API looked something like:
// 1. provide _all_ of the keys to get a single value back:
runtime::storage().pallet().entry(key1, key2, key3);// 2. provide some subset of keys. All of these allow iterating over results beneath them:
runtime::storage().pallet().entry_iter0();
runtime::storage().pallet().entry_iter1(key1);
runtime::storage().pallet().entry_iter2(key1, key2);
Here, entry would be Fetchable but not Iterable, and all of the _iter functions would be Iterable but not Fetchable.
Right now, one can call .to_root_key() on some entry to be able to iterate over the root things. Additionally, something like runtime::storage().pallet().entry(key1, key2, key3) is Iterable (iteration calls .to_root_key()). I'd propose scrapping both of these, ie:
Iterating over a key should never call .to_root_key(); it'll just iterate whatever was given.
If you provide every key eg runtime::storage().pallet().entry(key1, key2, key3);, you cannot iterate over this. Instead you'll have to construct a new entry with as many partial keys as you want to iterate, so it's explicit what you're actually iterating over.
Currently, when accessing storage maps (ie storage entries that require some key to be provided) we have two options:
When more than one key is needed, it'd be nice if people could provide any subset of the required keys to be able to iterate over all of the remaining values. In other words it'd be nice if the API looked something like:
Here,
entry
would beFetchable
but notIterable
, and all of the_iter
functions would be Iterable but notFetchable
.Right now, one can call
.to_root_key()
on some entry to be able to iterate over the root things. Additionally, something likeruntime::storage().pallet().entry(key1, key2, key3)
isIterable
(iteration calls.to_root_key()
). I'd propose scrapping both of these, ie:.to_root_key()
; it'll just iterate whatever was given.runtime::storage().pallet().entry(key1, key2, key3);
, you cannot iterate over this. Instead you'll have to construct a new entry with as many partial keys as you want to iterate, so it's explicit what you're actually iterating over.See #1038 for the original inspiration.
The text was updated successfully, but these errors were encountered: