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

#20 in #append

Download history 20/week @ 2024-06-26 15/week @ 2024-07-03 100/week @ 2024-07-10 114/week @ 2024-07-17 4/week @ 2024-07-24 26/week @ 2024-09-11 25/week @ 2024-09-18 187/week @ 2024-09-25 40/week @ 2024-10-02 87/week @ 2024-10-09

340 downloads per month
Used in 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

~17–32MB
~523K SLoC