pub struct Files<S: ?Sized, D: DeliveryHandler> { /* private fields */ }Expand description
A thread-safe registry of active File instances indexed by their Zircon pager port key.
Implementations§
Source§impl<S: BlockService + ?Sized + 'static, D: DeliveryHandler> Files<S, D>
impl<S: BlockService + ?Sized + 'static, D: DeliveryHandler> Files<S, D>
Sourcepub fn new(service: Arc<S>, delivery_handler: D, port: Port) -> Self
pub fn new(service: Arc<S>, delivery_handler: D, port: Port) -> Self
Creates a new file registry with the provided block service, delivery handler, and port.
Creates a new file registry sharing an existing Arc<D> delivery handler, optionally
mapped as a child session over parent_file.
Sourcepub fn start_recording(&self) -> Result<(), Status>
pub fn start_recording(&self) -> Result<(), Status>
Starts recording a profile of page requests serviced by self.
While active, each serviced page request records a FileMessage containing the file’s
Zircon pager port key and the readahead-aligned uncompressed logical byte offset within
that file.
Returns Err(zx::Status::BAD_STATE) if a recording is already active.
pub fn is_recording(&self) -> bool
Sourcepub fn stop_recording(&self) -> Result<Vmo, Status>
pub fn stop_recording(&self) -> Result<Vmo, Status>
Stops the active profile recording and returns a VMO containing the recorded
FileMessage items.
Returns Err(zx::Status::BAD_STATE) if no recording is active.
Sourcepub fn abort_recording(&self)
pub fn abort_recording(&self)
Aborts any active profile recording.
Sourcepub fn delivery_handler(&self) -> &Arc<D> ⓘ
pub fn delivery_handler(&self) -> &Arc<D> ⓘ
Returns a reference to the DeliveryHandler backing this registry.
Sourcepub fn has_parent(&self) -> bool
pub fn has_parent(&self) -> bool
Returns true if this registry belongs to a child session whose files map logical byte
ranges within a parent file.
Sourcepub fn spawn_pager_thread(self: &Arc<Self>) -> PagerThread<S, D>
pub fn spawn_pager_thread(self: &Arc<Self>) -> PagerThread<S, D>
Spawns a background thread to service pager requests for self.
Sourcepub fn register_blob(
&self,
key: u64,
merkle_leaves: &[[u8; 32]],
read_alignment: usize,
) -> Result<(), Error>
pub fn register_blob( &self, key: u64, merkle_leaves: &[[u8; 32]], read_alignment: usize, ) -> Result<(), Error>
Registers a blob’s Merkle tree leaf hashes and delivery read alignment with the downstream delivery handler.
Sourcepub fn begin_loading(&self, key: u64)
pub fn begin_loading(&self, key: u64)
Marks key as currently loading metadata, preserving any page requests that arrived
prior to the mapping command.
Sourcepub fn get_file(&self, key: u64) -> Option<Arc<File>>
pub fn get_file(&self, key: u64) -> Option<Arc<File>>
Returns the loaded File registered under key, if present.
Source§impl<S: BlockService + ?Sized + 'static> Files<S, NoopDeliveryHandler>
impl<S: BlockService + ?Sized + 'static> Files<S, NoopDeliveryHandler>
Sourcepub fn new_without_pager(service: Arc<S>) -> Self
pub fn new_without_pager(service: Arc<S>) -> Self
Creates a file registry without a pager for intermediate (e.g. partition) sessions.
Auto Trait Implementations§
impl<S, D> !Freeze for Files<S, D>
impl<S, D> !RefUnwindSafe for Files<S, D>
impl<S, D> !UnwindSafe for Files<S, D>
impl<S, D> Send for Files<S, D>where
Arc<S>: Send,
Arc<D>: Send,
Mutex<RawSyncMutex, HashMap<u64, FileEntry<<D as DeliveryHandler>::Request>>>: Send,
Mutex<RawSyncMutex, Vec<(u64, Arc<File>, <D as DeliveryHandler>::Request)>>: Send,
S: ?Sized,
impl<S, D> Sync for Files<S, D>where
Arc<S>: Sync,
Arc<D>: Sync,
Mutex<RawSyncMutex, HashMap<u64, FileEntry<<D as DeliveryHandler>::Request>>>: Sync,
Mutex<RawSyncMutex, Vec<(u64, Arc<File>, <D as DeliveryHandler>::Request)>>: Sync,
S: ?Sized,
impl<S, D> Unpin for Files<S, D>where
Arc<S>: Unpin,
Arc<D>: Unpin,
Mutex<RawSyncMutex, HashMap<u64, FileEntry<<D as DeliveryHandler>::Request>>>: Unpin,
Mutex<RawSyncMutex, Vec<(u64, Arc<File>, <D as DeliveryHandler>::Request)>>: Unpin,
S: ?Sized,
impl<S, D> UnsafeUnpin for Files<S, D>where
Arc<S>: UnsafeUnpin,
Arc<D>: UnsafeUnpin,
Mutex<RawSyncMutex, HashMap<u64, FileEntry<<D as DeliveryHandler>::Request>>>: UnsafeUnpin,
Mutex<RawSyncMutex, Vec<(u64, Arc<File>, <D as DeliveryHandler>::Request)>>: UnsafeUnpin,
S: ?Sized,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more