Skip to main content

CountingVfs

Struct CountingVfs 

Source
pub struct CountingVfs<V> { /* private fields */ }
Expand description

Byte/call-counting decorator used by deterministic open-cost gates.

Implementations§

Source§

impl<V> CountingVfs<V>

Source

pub fn new(inner: V) -> Self

Wraps a filesystem with zeroed counters.

Source

pub fn with_read_path_filter(self, path: impl Into<PathBuf>) -> Self

Counts successful reads of one exact path separately from global reads.

Source

pub const fn inner(&self) -> &V

Returns the wrapped filesystem.

Source

pub fn open_calls(&self) -> u64

Returns observed open calls.

Source

pub fn open_for_map_calls(&self) -> u64

Returns observed mapping-file open calls.

Source

pub fn read_calls(&self) -> u64

Returns observed read calls.

Source

pub fn filtered_read_calls(&self) -> u64

Returns successful reads matching the configured exact path.

Source

pub fn read_bytes(&self) -> u64

Returns exact bytes returned by reads.

Source

pub fn segment_bytes_read(&self) -> u64

Returns exact bytes read from immutable segment paths.

Source

pub fn write_calls(&self) -> u64

Returns observed whole-file write calls.

Source

pub fn bytes_written(&self) -> u64

Returns exact bytes supplied to successful whole-file writes.

Source

pub fn append_calls(&self) -> u64

Returns observed successful handle append calls.

Source

pub fn bytes_appended(&self) -> u64

Returns exact bytes supplied to successful handle appends.

Source

pub fn rename_calls(&self) -> u64

Returns observed successful rename calls.

Source

pub fn delete_calls(&self) -> u64

Returns observed successful delete calls.

Source

pub fn enumerate_calls(&self) -> u64

Returns observed streaming directory-enumeration calls.

Source

pub fn barrier_sync_calls(&self) -> u64

Returns path-based barrier synchronization calls.

Source

pub fn full_sync_calls(&self) -> u64

Returns path-based full synchronization calls.

Source

pub fn handle_barrier_sync_calls(&self) -> u64

Returns open-handle barrier synchronization calls.

Source

pub fn handle_full_sync_calls(&self) -> u64

Returns open-handle full synchronization calls.

Source

pub fn reset(&self)

Resets all counters without changing the wrapped filesystem.

Trait Implementations§

Source§

impl<V: Vfs> Vfs for CountingVfs<V>

Source§

fn truncate(&self, path: &Path, length: u64) -> Result<()>

Removes a suffix without copying the retained file bytes.
Source§

fn create_new(&self, path: &Path, bytes: &[u8]) -> Result<()>

Exclusively creates a file and writes every byte without replacing any existing path. A failed write may leave a new partial file; callers must retain it as an uncommitted artifact until safe cleanup is established. Filesystems without atomic exclusive creation fail explicitly.
Source§

fn create_directory(&self, path: &Path) -> Result<()>

Exclusively creates one directory. Existing paths are preserved and reported as AlreadyExists; no ancestor is adopted implicitly.
Source§

fn remove_directory(&self, path: &Path) -> Result<()>

Removes one empty directory. A non-empty directory is an error.
Source§

fn ensure_directory(&self, path: &Path, create: bool) -> Result<bool>

Admits a store directory, creating missing ancestors when requested, and reports whether the resulting path is a directory.
Source§

fn open(&self, path: &Path) -> Result<u64>

Opens an existing path and returns its byte length.
Source§

fn open_for_map(&self, path: &Path) -> Result<File>

Opens an existing path as an owned file suitable for memory mapping. Read more
Source§

fn read(&self, path: &Path) -> Result<Vec<u8>>

Reads an entire file.
Source§

fn read_range(&self, path: &Path, offset: u64, length: usize) -> Result<Vec<u8>>

Reads at most length bytes beginning at offset.
Source§

fn write(&self, path: &Path, bytes: &[u8]) -> Result<()>

Creates or truncates a file and writes all bytes.
Source§

fn open_append(&self, path: &Path) -> Result<Box<dyn VfsFile>>

Opens or creates one file for handle-oriented append-only writes.
Source§

fn rename(&self, from: &Path, to: &Path) -> Result<()>

Atomically renames one path over another according to platform semantics.
Source§

fn sync(&self, path: &Path, kind: SyncKind) -> Result<()>

Synchronizes a file or directory using an explicit platform primitive.
Source§

fn list(&self, directory: &Path) -> Result<Vec<PathBuf>>

Lists direct children of a directory.
Source§

fn for_each_direct_child( &self, directory: &Path, visitor: &mut dyn FnMut(&Path) -> Result<()>, ) -> Result<()>

Visits direct children one at a time without collecting the directory.
Source§

fn delete(&self, path: &Path) -> Result<()>

Deletes one file.

Auto Trait Implementations§

§

impl<V> Freeze for CountingVfs<V>
where V: Freeze,

§

impl<V> RefUnwindSafe for CountingVfs<V>
where V: RefUnwindSafe,

§

impl<V> Send for CountingVfs<V>
where V: Send,

§

impl<V> Sync for CountingVfs<V>
where V: Sync,

§

impl<V> Unpin for CountingVfs<V>
where V: Unpin,

§

impl<V> UnsafeUnpin for CountingVfs<V>
where V: UnsafeUnpin,

§

impl<V> UnwindSafe for CountingVfs<V>
where V: UnwindSafe,

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.