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
impl FxVolume
pub fn new( parent: Weak<VolumesDirectory>, store: Arc<ObjectStore>, fs_id: u64, blob_resupplied_count: Arc<PageRefaultCounter>, memory_pressure_config: MemoryPressureConfig, ) -> Result<Self, Error>
pub fn store(&self) -> &Arc<ObjectStore>
pub fn cache(&self) -> &NodeCache
pub fn dirent_cache(&self) -> &DirentCache
pub fn pager(&self) -> &Pager
pub fn id(&self) -> u64
pub fn scope(&self) -> &ExecutionScope
pub fn blob_resupplied_count(&self) -> &PageRefaultCounter
Sourcepub fn filesystem_info_for_volume(&self) -> FilesystemInfo
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.
Sourcepub async fn stop_profile_tasks(self: &Arc<Self>)
pub async fn stop_profile_tasks(self: &Arc<Self>)
Stop profiling, recover resources from it and finalize recordings.
Sourcepub async fn get_profile_directory(
self: &Arc<Self>,
) -> Result<Directory<FxVolume>, Error>
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.
Sourcepub async fn record_or_replay_profile(
self: &Arc<Self>,
state: Box<dyn ProfileState>,
name: &str,
) -> Result<(), Error>
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.
pub async fn terminate(&self)
Sourcepub async fn get_or_load_node(
self: &Arc<Self>,
object_id: u64,
object_descriptor: ObjectDescriptor,
parent: Option<Arc<FxDirectory>>,
) -> Result<Arc<dyn FxNode>, Error>
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.
Sourcepub fn mark_directory_deleted(&self, object_id: u64)
pub fn mark_directory_deleted(&self, object_id: u64)
Marks the given directory deleted.
Sourcepub fn start_background_task(
self: &Arc<Self>,
config: MemoryPressureConfig,
mem_monitor: Option<&MemoryPressureMonitor>,
)
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.
Sourcepub fn report_pager_dirty(
self: Arc<Self>,
byte_count: u64,
mark_dirty: impl FnOnce() + Send + 'static,
)
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.
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.
pub async fn flush_all_files(&self, last_chance: bool)
Sourcepub async fn minimize_memory(&self)
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.
Sourcepub fn spawn(&self, task: impl Future<Output = ()> + Send + 'static)
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.
Sourcepub fn read_ahead_size(&self) -> u64
pub fn read_ahead_size(&self) -> u64
Returns the current read-ahead size that should be used based on the current memory-pressure level.
pub async fn handle_file_backed_volume_provider_requests( this: Weak<Self>, scope: ExecutionScope, requests: FileBackedVolumeProviderRequestStream, ) -> Result<(), Error>
pub async fn handle_project_id_requests( this: Weak<Self>, scope: ExecutionScope, requests: ProjectIdRequestStream, ) -> Result<(), Error>
Trait Implementations§
Source§impl AsRef<ObjectStore> for FxVolume
impl AsRef<ObjectStore> for FxVolume
Source§fn as_ref(&self) -> &ObjectStore
fn as_ref(&self) -> &ObjectStore
Source§impl FsInspectVolume for FxVolume
impl FsInspectVolume for FxVolume
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,
impl HandleOwner for FxVolume
Auto Trait Implementations§
impl !Freeze for FxVolume
impl !RefUnwindSafe for FxVolume
impl Send for FxVolume
impl Sync for FxVolume
impl Unpin for FxVolume
impl UnsafeUnpin for FxVolume
impl !UnwindSafe for FxVolume
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