Skip to main content

FxVolume

Struct FxVolume 

Source
pub struct FxVolume { /* private fields */ }
Expand description

FxVolume represents an opened volume. It is also a (weak) cache for all opened Nodes within the volume.

Implementations§

Source§

impl FxVolume

Source

pub fn new( parent: Weak<VolumesDirectory>, store: Arc<ObjectStore>, fs_id: u64, blob_resupplied_count: Arc<PageRefaultCounter>, memory_pressure_config: MemoryPressureConfig, ) -> Result<Self, Error>

Source

pub fn store(&self) -> &Arc<ObjectStore>

Source

pub fn cache(&self) -> &NodeCache

Source

pub fn dirent_cache(&self) -> &DirentCache

Source

pub fn pager(&self) -> &Pager

Source

pub fn id(&self) -> u64

Source

pub fn scope(&self) -> &ExecutionScope

Source

pub fn blob_resupplied_count(&self) -> &PageRefaultCounter

Source

pub fn filesystem_info_for_volume(&self) -> FilesystemInfo

Reports the filesystem info, but if the volume has a space limit applied then the space available and space used are reported based on the volume instead.

Source

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

Stop profiling, recover resources from it and finalize recordings.

Source

pub async fn get_profile_directory( self: &Arc<Self>, ) -> Result<Directory<FxVolume>, Error>

Opens or creates the profile directory in the volume’s internal directory.

Source

pub async fn record_or_replay_profile( self: &Arc<Self>, state: Box<dyn ProfileState>, name: &str, ) -> Result<(), Error>

Starts recording a profile for the volume under the name given, and if a profile exists under that same name it is replayed and will be replaced after by the new recording if it is cleanly shutdown and finalized.

Source

pub async fn terminate(&self)

Source

pub async fn get_or_load_node( self: &Arc<Self>, object_id: u64, object_descriptor: ObjectDescriptor, parent: Option<Arc<FxDirectory>>, ) -> Result<Arc<dyn FxNode>, Error>

Attempts to get a node from the node cache. If the node wasn’t present in the cache, loads the object from the object store, installing the returned node into the cache and returns the newly created FxNode backed by the loaded object. |parent| is only set on the node if the node was not present in the cache. Otherwise, it is ignored.

Source

pub fn mark_directory_deleted(&self, object_id: u64)

Marks the given directory deleted.

Source

pub fn start_background_task( self: &Arc<Self>, config: MemoryPressureConfig, mem_monitor: Option<&MemoryPressureMonitor>, )

Starts the background work task. This task will periodically:

  • scan all files and flush them to disk, and
  • purge unused cached data. The task will hold a strong reference to the FxVolume while it is running, so the task must be closed later with Self::terminate, or the FxVolume will never be dropped.
Source

pub fn report_pager_dirty( self: Arc<Self>, byte_count: u64, mark_dirty: impl FnOnce() + Send + 'static, )

Reports that a certain number of bytes will be dirtied in a pager-backed VMO.

Note that this function may await flush tasks.

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 async fn flush_all_files(&self, last_chance: bool)

Source

pub async fn minimize_memory(&self)

Flushes only files with dirty pages.

PagedObjectHandle tracks the number dirty pages locally (except for overwrite files) which makes determining whether flushing a file will reduce the number of dirty pages efficient. flush_all_files checks if any metadata needs to be flushed which involves a syscall making it significantly slower when there are lots of open files without dirty pages.

Source

pub fn spawn(&self, task: impl Future<Output = ()> + Send + 'static)

Spawns a short term task for the volume that includes a guard that will prevent termination.

Source

pub fn read_ahead_size(&self) -> u64

Returns the current read-ahead size that should be used based on the current memory-pressure level.

Source

pub async fn handle_file_backed_volume_provider_requests( this: Weak<Self>, scope: ExecutionScope, requests: FileBackedVolumeProviderRequestStream, ) -> Result<(), Error>

Source

pub async fn handle_project_id_requests( this: Weak<Self>, scope: ExecutionScope, requests: ProjectIdRequestStream, ) -> Result<(), Error>

Trait Implementations§

Source§

impl AsRef<ObjectStore> for FxVolume

Source§

fn as_ref(&self) -> &ObjectStore

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl FsInspectVolume for FxVolume

Source§

fn get_volume_data<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = VolumeData> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl HandleOwner for FxVolume

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