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

Trait QueueFootprintQuery

Source
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§

Source

type MaxMessageLen: Get<u32>

The maximal length any enqueued message may have.

Required Methods§

Source

fn footprint(origin: Origin) -> QueueFootprint

Return the state footprint of the given queue.

Source

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§

Source§

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

Source§

type MaxMessageLen = ConstU32<0>

Source§

fn footprint(_: Origin) -> QueueFootprint

Source§

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

Implementors§

Source§

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

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