16 breaking releases

0.16.0 Sep 26, 2024
0.15.0 Jul 18, 2024
0.14.0 Jul 12, 2024
0.9.0 Mar 18, 2024
0.0.0 May 13, 2023

#27 in #append

Download history 3/week @ 2024-07-25 29/week @ 2024-09-12 30/week @ 2024-09-19 187/week @ 2024-09-26 37/week @ 2024-10-03 98/week @ 2024-10-10 145/week @ 2024-10-17 180/week @ 2024-10-24 282/week @ 2024-10-31 10053/week @ 2024-11-07

10,696 downloads per month
Used in 8 crates (via polkadot-sdk)

Apache-2.0

2.5MB
44K SLoC

Release

Polkadot SDK stable2409


lib.rs:

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

~18–34MB
~546K SLoC