FileSystemMonitor

Struct FileSystemMonitor 

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

File system monitor for detecting file operations

Monitors file system for create, modify, delete, rename, move, and read operations. Emits events when operations are detected.

Implementations§

Source§

impl FileSystemMonitor

Source

pub fn new() -> Self

Create a new file system monitor

Source

pub fn emit_file_created(&self, path: PathBuf, size: u64) -> FileOperationEvent

Emit a file created event

§Arguments
  • path - Path to the created file
  • size - Size of the file in bytes
§Returns

A FileOperationEvent::Created event

Source

pub fn emit_file_modified( &self, path: PathBuf, old_hash: String, new_hash: String, ) -> FileOperationEvent

Emit a file modified event

§Arguments
  • path - Path to the modified file
  • old_hash - Hash of the file before modification
  • new_hash - Hash of the file after modification
§Returns

A FileOperationEvent::Modified event

Source

pub fn emit_file_deleted(&self, path: PathBuf) -> FileOperationEvent

Emit a file deleted event

§Arguments
  • path - Path to the deleted file
§Returns

A FileOperationEvent::Deleted event

Source

pub fn emit_file_renamed( &self, old_path: PathBuf, new_path: PathBuf, ) -> FileOperationEvent

Emit a file renamed event

§Arguments
  • old_path - Original path of the file
  • new_path - New path of the file
§Returns

A FileOperationEvent::Renamed event

Source

pub fn emit_file_moved( &self, old_path: PathBuf, new_path: PathBuf, ) -> FileOperationEvent

Emit a file moved event

§Arguments
  • old_path - Original path of the file
  • new_path - New path of the file
§Returns

A FileOperationEvent::Moved event

Source

pub fn emit_file_read(&self, path: PathBuf) -> FileOperationEvent

Emit a file read event

§Arguments
  • path - Path to the file that was read
§Returns

A FileOperationEvent::Read event

Source

pub fn emit_directory_created(&self, path: PathBuf) -> DirectoryOperationEvent

Emit a directory created event

§Arguments
  • path - Path to the created directory
§Returns

A DirectoryOperationEvent::Created event

Source

pub fn emit_directory_deleted(&self, path: PathBuf) -> DirectoryOperationEvent

Emit a directory deleted event

§Arguments
  • path - Path to the deleted directory
§Returns

A DirectoryOperationEvent::Deleted event

Source

pub async fn track_file_hash(&self, path: PathBuf, hash: String)

Track a file hash for modification detection

§Arguments
  • path - Path to the file
  • hash - Hash of the file content
Source

pub async fn get_file_hash(&self, path: &PathBuf) -> Option<String>

Get the tracked hash for a file

§Arguments
  • path - Path to the file
§Returns

The tracked hash if it exists

Source

pub async fn remove_file_hash(&self, path: &PathBuf)

Remove a tracked file hash

§Arguments
  • path - Path to the file
Source

pub async fn clear_file_hashes(&self)

Clear all tracked file hashes

Trait Implementations§

Source§

impl Clone for FileSystemMonitor

Source§

fn clone(&self) -> FileSystemMonitor

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FileSystemMonitor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FileSystemMonitor

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more