pub trait PagerBacked:
FxNode
+ Sync
+ Send
+ Sized
+ 'static {
// Required methods
fn pager(&self) -> &Pager;
fn pager_packet_receiver_registration(
&self,
) -> &PagerPacketReceiverRegistration<Self>;
fn vmo(&self) -> &Vmo;
fn page_in(self: Arc<Self>, range: PageInRange<Self>);
fn mark_dirty(self: Arc<Self>, range: MarkDirtyRange<Self>);
fn on_zero_children(self: Arc<Self>);
fn byte_size(&self) -> u64;
fn aligned_read(
&self,
aligned_byte_range: Range<u64>,
) -> impl Future<Output = Result<Buffer<'_>, Error>> + Send;
}Expand description
This is a trait for objects (files/blobs) that expose a pager backed VMO.
Required Methods§
Sourcefn pager_packet_receiver_registration(
&self,
) -> &PagerPacketReceiverRegistration<Self>
fn pager_packet_receiver_registration( &self, ) -> &PagerPacketReceiverRegistration<Self>
The receiver registration returned from Pager::create_vmo.
Sourcefn vmo(&self) -> &Vmo
fn vmo(&self) -> &Vmo
The pager backed VMO that this object is handling packets for. The VMO must be created with
Pager::create_vmo.
Sourcefn page_in(self: Arc<Self>, range: PageInRange<Self>)
fn page_in(self: Arc<Self>, range: PageInRange<Self>)
Called by the pager when a ZX_PAGER_VMO_READ packet is received for the VMO. The
implementation must respond by calling either PageInRange::supply_pages or
PageInRange::report_failure.
Sourcefn mark_dirty(self: Arc<Self>, range: MarkDirtyRange<Self>)
fn mark_dirty(self: Arc<Self>, range: MarkDirtyRange<Self>)
Called by the pager when a ZX_PAGER_VMO_DIRTY packet is received for the VMO. The
implementation must respond by calling either MarkDirtyRange::dirty_pages or
MarkDirtyRange::report_failure.
Sourcefn on_zero_children(self: Arc<Self>)
fn on_zero_children(self: Arc<Self>)
Called by the pager to indicate there are no more VMO children.
Sourcefn byte_size(&self) -> u64
fn byte_size(&self) -> u64
Total bytes readable. Anything reads over this will be zero padded in the VMO.
Sourcefn aligned_read(
&self,
aligned_byte_range: Range<u64>,
) -> impl Future<Output = Result<Buffer<'_>, Error>> + Send
fn aligned_read( &self, aligned_byte_range: Range<u64>, ) -> impl Future<Output = Result<Buffer<'_>, Error>> + Send
Reads one or more blocks into a buffer and returns it. This method is called by
default_page_in and aligned_byte_range will always be aligned to the read_ahead_size
past to default_page_in unless that would extend beyond self.byte_size(), in which case,
aligned_byte_range will end at self.byte_size()’s next page multiple. The returned
buffer must be at least as large as the requested range. Only the requested range will be
supplied to the pager.
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.