10 breaking releases

new 0.10.0 Apr 8, 2024
0.9.0 Mar 18, 2024
0.8.0 Feb 26, 2024
0.5.0 Dec 12, 2023
0.0.0 May 13, 2023

#2060 in Magic Beans

Download history 7/week @ 2024-01-22 24/week @ 2024-02-12 9/week @ 2024-02-19 182/week @ 2024-02-26 5/week @ 2024-03-04 2/week @ 2024-03-11 115/week @ 2024-03-18 116/week @ 2024-04-01

234 downloads per month

Apache-2.0

2.5MB
44K SLoC

Made with Substrate, for DotSama.

github - polkadot

Paged List Pallet

A thin wrapper pallet around a paged_list::StoragePagedList. It provides an API for a single paginated list. It can be instantiated multiple times to provide multiple lists.

Overview

The pallet is quite unique since it does not expose any Calls, Errors or Events. All interaction goes through the implemented StorageList trait.

A fuzzer for testing is provided in crate pallet-paged-list-fuzzer.

Examples

  1. Appending some data to the list can happen either by Pallet::append_one:
  2. or by Pallet::append_many. This should always be preferred to repeated calls to Pallet::append_one:
  3. If you want to append many values (ie. in a loop), then best use the Pallet::appender:
  4. Iterating over the list can be done with Pallet::iter. It uses the standard Iterator trait:
  5. Draining elements happens through the Pallet::drain iterator. Note that even peeking a value will already remove it.

Pallet API

None. Only things to consider is the Config traits.

Low Level / Implementation Details

Implementation details are documented in paged_list::StoragePagedList.
All storage entries are prefixed with a unique prefix that is generated by ListPrefix.

Dependencies

~17–30MB
~496K SLoC