pub struct VolumesDirectory { /* private fields */ }Expand description
VolumesDirectory is a special pseudo-directory used to enumerate and operate on volumes. Volume creation happens via fuchsia.fs.startup.Volumes.Create, rather than open.
Note that VolumesDirectory assumes exclusive access to |root_volume| and if volumes are manipulated from elsewhere, strange things will happen.
Implementations§
Source§impl VolumesDirectory
impl VolumesDirectory
Sourcepub async fn new(
root_volume: RootVolume,
inspect_tree: Weak<FsInspectTree>,
mem_monitor: Option<MemoryPressureMonitor>,
blob_resupplied_count: Arc<PageRefaultCounter>,
memory_pressure_config: MemoryPressureConfig,
) -> Result<Arc<Self>, Error>
pub async fn new( root_volume: RootVolume, inspect_tree: Weak<FsInspectTree>, mem_monitor: Option<MemoryPressureMonitor>, blob_resupplied_count: Arc<PageRefaultCounter>, memory_pressure_config: MemoryPressureConfig, ) -> Result<Arc<Self>, Error>
Fills the VolumesDirectory with all volumes in |root_volume|. No volume is opened during this.
Sourcepub async fn delete_profile(
self: &Arc<Self>,
volume_name: &str,
profile_name: &str,
) -> Result<(), Status>
pub async fn delete_profile( self: &Arc<Self>, volume_name: &str, profile_name: &str, ) -> Result<(), Status>
Delete a profile for a given volume. Fails if that volume isn’t mounted or if there is active profile recording or replay.
pub fn memory_pressure_monitor(&self) -> Option<&MemoryPressureMonitor>
Sourcepub async fn stop_profile_tasks(self: &Arc<Self>)
pub async fn stop_profile_tasks(self: &Arc<Self>)
Stop all ongoing replays, and complete and persist ongoing recordings.
Sourcepub async fn record_or_replay_profile(
self: Arc<Self>,
profile_name: String,
duration_secs: u32,
) -> Result<(), Error>
pub async fn record_or_replay_profile( self: Arc<Self>, profile_name: String, duration_secs: u32, ) -> Result<(), Error>
Record a named profile for a number of seconds, fails if there is an in flight recording or replay.
Sourcepub fn directory_node(&self) -> &Arc<Simple>
pub fn directory_node(&self) -> &Arc<Simple>
Returns the directory node which can be used to provide connections for e.g. enumerating entries in the VolumesDirectory. Directly manipulating the entries in this node will result in strange behaviour.
pub async fn lock<'a>(self: &'a Arc<Self>) -> MountedVolumesGuard<'a>
Sourcepub async fn create_and_mount_volume(
self: &Arc<Self>,
name: &str,
crypt: Option<Arc<dyn Crypt>>,
as_blob: bool,
guid: Option<[u8; 16]>,
) -> Result<FxVolumeAndRoot, Error>
pub async fn create_and_mount_volume( self: &Arc<Self>, name: &str, crypt: Option<Arc<dyn Crypt>>, as_blob: bool, guid: Option<[u8; 16]>, ) -> Result<FxVolumeAndRoot, Error>
Creates and mounts a new volume. If |crypt| is set, the volume will be encrypted. The volume is mounted according to |as_blob|.
Sourcepub async fn mount_volume(
self: &Arc<Self>,
name: &str,
crypt: Option<Arc<dyn Crypt>>,
as_blob: bool,
) -> Result<FxVolumeAndRoot, Error>
pub async fn mount_volume( self: &Arc<Self>, name: &str, crypt: Option<Arc<dyn Crypt>>, as_blob: bool, ) -> Result<FxVolumeAndRoot, Error>
Mounts an existing volume. crypt will be used to unlock the volume if provided.
If as_blob is true, the volume will be mounted as a blob filesystem, otherwise
it will be treated as a regular fxfs volume.
Sourcepub async fn remove_volume(self: &Arc<Self>, name: &str) -> Result<(), Error>
pub async fn remove_volume(self: &Arc<Self>, name: &str) -> Result<(), Error>
Removes a volume. The volume must exist but encrypted volume keys are not required.
Sourcepub async fn terminate(self: &Arc<Self>)
pub async fn terminate(self: &Arc<Self>)
Terminates all opened volumes. This will not cancel any profiling that might be taking place.
Sourcepub fn serve_volume(
self: &Arc<Self>,
volume: &FxVolumeAndRoot,
outgoing_dir_server_end: ServerEnd<DirectoryMarker>,
as_blob: bool,
) -> Result<(), Error>
pub fn serve_volume( self: &Arc<Self>, volume: &FxVolumeAndRoot, outgoing_dir_server_end: ServerEnd<DirectoryMarker>, as_blob: bool, ) -> Result<(), Error>
Serves the given volume on outgoing_dir_server_end.
Sourcepub async fn create_and_serve_volume(
self: &Arc<Self>,
name: &str,
outgoing_directory_server_end: ServerEnd<DirectoryMarker>,
mount_options: MountOptions,
create_options: CreateOptions,
) -> Result<(), Error>
pub async fn create_and_serve_volume( self: &Arc<Self>, name: &str, outgoing_directory_server_end: ServerEnd<DirectoryMarker>, mount_options: MountOptions, create_options: CreateOptions, ) -> Result<(), Error>
Creates and serves the volume with the given name.
pub fn memory_pressure_config(&self) -> &MemoryPressureConfig
Sourcepub fn report_pager_dirty(
self: Arc<Self>,
byte_count: u64,
volume: Arc<FxVolume>,
mark_dirty: impl FnOnce() + Send + 'static,
)
pub fn report_pager_dirty( self: Arc<Self>, byte_count: u64, volume: Arc<FxVolume>, mark_dirty: impl FnOnce() + Send + 'static, )
Reports that a certain number of bytes will be dirtied in a pager-backed VMO. If the memory
pressure level is critical and fxfs has lots of dirty pages then a new task will be spawned
in volume to flush the dirty pages before mark_dirty is called. If the memory pressure
level is not critical then mark_dirty will be synchronously called.
Sourcepub fn report_pager_clean(&self, byte_count: u64)
pub fn report_pager_clean(&self, byte_count: u64)
Reports that a certain number of bytes were cleaned in a pager-backed VMO.
Sourcepub fn set_on_mount_callback<F: Fn(&str, Option<Arc<ObjectStore>>) + Send + Sync + 'static>(
&self,
callback: F,
)
pub fn set_on_mount_callback<F: Fn(&str, Option<Arc<ObjectStore>>) + Send + Sync + 'static>( &self, callback: F, )
Sets a callback which is invoked when a volume is added. When the volume is removed, this
is called again with None as the second parameter.
Note that this can only be set once per VolumesDirectory; repeated calls will panic.
pub async fn install_volume( self: &Arc<Self>, src: &str, image_file: &str, dst: &str, ) -> Result<(), Error>
Trait Implementations§
Source§impl StoreOwner for VolumesDirectory
impl StoreOwner for VolumesDirectory
Source§fn force_lock<'life0, 'async_trait>(
self: Arc<Self>,
store: &'life0 ObjectStore,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn force_lock<'life0, 'async_trait>(
self: Arc<Self>,
store: &'life0 ObjectStore,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl !Freeze for VolumesDirectory
impl !RefUnwindSafe for VolumesDirectory
impl Send for VolumesDirectory
impl Sync for VolumesDirectory
impl Unpin for VolumesDirectory
impl UnsafeUnpin for VolumesDirectory
impl !UnwindSafe for VolumesDirectory
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
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to [Self]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