Skip to main content

VolumesDirectory

Struct VolumesDirectory 

Source
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

Source

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.

Source

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.

Source

pub fn memory_pressure_monitor(&self) -> Option<&MemoryPressureMonitor>

Source

pub async fn stop_profile_tasks(self: &Arc<Self>)

Stop all ongoing replays, and complete and persist ongoing recordings.

Source

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.

Source

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.

Source

pub async fn lock<'a>(self: &'a Arc<Self>) -> MountedVolumesGuard<'a>

Source

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|.

Source

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.

Source

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.

Source

pub async fn terminate(self: &Arc<Self>)

Terminates all opened volumes. This will not cancel any profiling that might be taking place.

Source

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.

Source

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.

Source

pub fn memory_pressure_config(&self) -> &MemoryPressureConfig

Source

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.

Source

pub fn report_pager_clean(&self, byte_count: u64)

Reports that a certain number of bytes were cleaned in a pager-backed VMO.

Source

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.

Source

pub async fn install_volume( self: &Arc<Self>, src: &str, image_file: &str, dst: &str, ) -> Result<(), Error>

Trait Implementations§

Source§

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,

Forcibly lock the store. This exists to give the StoreOwner an opportunity to clean up tasks which might access the store before locking it, because ObjectStore::unlock can only be called when the store is not in use.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> InstanceFromServiceTransport<T> for T

§

fn from_service_transport(handle: T) -> T

Converts the given service transport handle of type T to [Self]
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoAny for T
where T: 'static + Send + Sync,

Source§

fn into_any(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Cast the given object into a dyn std::any::Any.
Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<E> RunsTransport<Mpsc> for E

§

impl<E> RunsTransport<Mpsc> for E
where E: RunsTransport<Mpsc>,