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§
Sourcetype MaxMessageLen: Get<u32>
type MaxMessageLen: Get<u32>
The maximal length any enqueued message may have.
Required Methods§
Sourcefn footprint(origin: Origin) -> QueueFootprint
fn footprint(origin: Origin) -> QueueFootprint
Return the state footprint of the given queue.
Sourcefn get_batches_footprints<'a>(
origin: Origin,
msgs: impl Iterator<Item = BoundedSlice<'a, u8, Self::MaxMessageLen>>,
total_pages_limit: u32,
) -> BatchesFootprints
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.