referrerpolicy=no-referrer-when-downgrade
polkadot_sdk_frame::traits

Trait QueueFootprintQuery

pub trait QueueFootprintQuery<Origin> {
    type MaxMessageLen: Get<u32>;

    // Required methods
    fn footprint(origin: Origin) -> QueueFootprint;
    fn get_batches_footprints<'a>(
        origin: Origin,
        msgs: impl Iterator<Item = BoundedSlice<'a, u8, Self::MaxMessageLen>>,
        total_pages_limit: u32,
    ) -> BatchesFootprints;
}
Expand description

Provides information on queue footprint.

Required Associated Types§

type MaxMessageLen: Get<u32>

The maximal length any enqueued message may have.

Required Methods§

fn footprint(origin: Origin) -> QueueFootprint

Return the state footprint of the given queue.

fn get_batches_footprints<'a>( origin: Origin, msgs: impl Iterator<Item = BoundedSlice<'a, u8, Self::MaxMessageLen>>, total_pages_limit: u32, ) -> BatchesFootprints

Get the BatchFootprint for each batch of messages [0..n] as long as the total number of pages would be <= total_pages_limit.

§Examples

Let’s consider that each message would result in a new page and that there’s already 1 full page in the queue. Then, for the messages ["1", "2", "3"] and total_pages_limit = 3, get_batches_footprints() would return:

use frame_support::traits::BatchFootprint;

vec![
	// The footprint of batch ["1"]
	BatchFootprint {
		msgs_count: 1,
		size_in_bytes: 1,
		new_pages_count: 1, // total pages count = 2
	},
	// The footprint of batch ["1", "2"]
	BatchFootprint {
		msgs_count: 2,
		size_in_bytes: 2,
		new_pages_count: 2, // total pages count = 3
	}
	// For the batch ["1", "2", "3"], the total pages count would be 4, which would exceed
	// the `total_pages_limit`.
];

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

§

impl<Origin> QueueFootprintQuery<Origin> for ()
where Origin: MaxEncodedLen,

§

type MaxMessageLen = ConstU32<0>

§

fn footprint(_: Origin) -> QueueFootprint

§

fn get_batches_footprints<'a>( _origin: Origin, _msgs: impl Iterator<Item = BoundedSlice<'a, u8, <() as QueueFootprintQuery<Origin>>::MaxMessageLen>>, _total_pages_limit: u32, ) -> BatchesFootprints

Implementors§

§

impl<E, O, N, C> QueueFootprintQuery<N> for TransformOrigin<E, O, N, C>
where E: QueueFootprintQuery<O>, O: MaxEncodedLen, N: MaxEncodedLen, C: Convert<N, O>,

impl<T: Config> QueueFootprintQuery<<<T as Config>::MessageProcessor as ProcessMessage>::Origin> for Pallet<T>