-
Notifications
You must be signed in to change notification settings - Fork 2.6k
[FRAME] Paginated Storage Primitives #14747
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
The CI pipeline was cancelled due to failure one of the required jobs. |
I have yet to learn the source code, but I am curious about the counter of DoubleMap or NMap. Does this is the scope of the PR aim? Does the counter support multi-level? Does the pagination ensure the results are ordered for map structures? |
@jasl after reading your comment irealize that the name of the storage primitives is badly chosen. Its not really a "Map" in the common sense; its rather a List structure that can be accessed through a map key. |
Thank you for clarifying! So this feature is for optimizing iterating a full list of storage? like when doing migration? |
The
paged-list
pallet provides a quite narrow solution to the problem of paginated data structures.This MR implements
StorageList
andStoragePagedNMap
. Only the latter contains code, the former is an adapter type of it. Alike it should be possible to use it asStoragePagedDoubleMap
andStoragePagedMap
. All variants are counted, so theCounted
prefix is omitted.Metadata
It currently uses fudged metadata by setting the metadata of a
StoragePagedList<Value>
to the metadata of aStorageMap<u32, Vec<Value>>
. This is correct on the storage level, since it maps the page-index (u32
) to a page (Vec<Value>
), but when reading the page, it is unclear to the reader which offset to use within the page.FRAME metadata V16 would be needed to fix this properly so that the reader is aware of the metadata field in storage.
Changes
len()
.