pub struct FileManager { /* private fields */ }
Expand description
Main file manager
Implementations§
Source§impl FileManager
impl FileManager
Sourcepub fn new(config: FileConfig) -> Self
pub fn new(config: FileConfig) -> Self
Create a new file manager
Sourcepub fn set_event_bus(&mut self, event_bus: Arc<EventBusManager>)
pub fn set_event_bus(&mut self, event_bus: Arc<EventBusManager>)
Set event bus for publishing file events
Sourcepub async fn read_file_to_string(
&self,
path: impl AsRef<Path>,
) -> Result<String>
pub async fn read_file_to_string( &self, path: impl AsRef<Path>, ) -> Result<String>
Read file contents as string
Sourcepub async fn write_file(
&self,
path: impl AsRef<Path>,
data: &[u8],
options: Option<FileOperationOptions>,
) -> Result<()>
pub async fn write_file( &self, path: impl AsRef<Path>, data: &[u8], options: Option<FileOperationOptions>, ) -> Result<()>
Write data to file
Sourcepub async fn copy_file(
&self,
source: impl AsRef<Path>,
destination: impl AsRef<Path>,
options: Option<FileOperationOptions>,
) -> Result<u64>
pub async fn copy_file( &self, source: impl AsRef<Path>, destination: impl AsRef<Path>, options: Option<FileOperationOptions>, ) -> Result<u64>
Copy file
Sourcepub async fn move_file(
&self,
source: impl AsRef<Path>,
destination: impl AsRef<Path>,
options: Option<FileOperationOptions>,
) -> Result<()>
pub async fn move_file( &self, source: impl AsRef<Path>, destination: impl AsRef<Path>, options: Option<FileOperationOptions>, ) -> Result<()>
Move/rename file
Sourcepub async fn create_directory(
&self,
path: impl AsRef<Path>,
recursive: bool,
) -> Result<()>
pub async fn create_directory( &self, path: impl AsRef<Path>, recursive: bool, ) -> Result<()>
Create directory
Sourcepub async fn delete_directory(
&self,
path: impl AsRef<Path>,
recursive: bool,
) -> Result<()>
pub async fn delete_directory( &self, path: impl AsRef<Path>, recursive: bool, ) -> Result<()>
Delete directory
Sourcepub async fn list_directory(
&self,
path: impl AsRef<Path>,
) -> Result<Vec<FileMetadata>>
pub async fn list_directory( &self, path: impl AsRef<Path>, ) -> Result<Vec<FileMetadata>>
List directory contents
Sourcepub async fn get_metadata(&self, path: impl AsRef<Path>) -> Result<FileMetadata>
pub async fn get_metadata(&self, path: impl AsRef<Path>) -> Result<FileMetadata>
Get file metadata
Sourcepub async fn create_temp_file(
&self,
prefix: Option<&str>,
suffix: Option<&str>,
) -> Result<PathBuf>
pub async fn create_temp_file( &self, prefix: Option<&str>, suffix: Option<&str>, ) -> Result<PathBuf>
Create temporary file
Sourcepub async fn cleanup_temp_files(&self, max_age: Duration) -> Result<u64>
pub async fn cleanup_temp_files(&self, max_age: Duration) -> Result<u64>
Clean up temporary files
Sourcepub async fn watch_path(
&mut self,
path: impl AsRef<Path>,
recursive: bool,
) -> Result<()>
pub async fn watch_path( &mut self, path: impl AsRef<Path>, recursive: bool, ) -> Result<()>
Start watching a path for changes
Sourcepub async fn unwatch_path(&mut self, path: impl AsRef<Path>) -> Result<()>
pub async fn unwatch_path(&mut self, path: impl AsRef<Path>) -> Result<()>
Stop watching a path
Sourcepub fn subscribe_to_changes(&self) -> Option<Receiver<FileChangeEvent>>
pub fn subscribe_to_changes(&self) -> Option<Receiver<FileChangeEvent>>
Subscribe to file change events
Sourcepub async fn compress_file(
&self,
source: impl AsRef<Path>,
destination: impl AsRef<Path>,
) -> Result<()>
pub async fn compress_file( &self, source: impl AsRef<Path>, destination: impl AsRef<Path>, ) -> Result<()>
Compress file using configured compression
Sourcepub async fn decompress_file(
&self,
source: impl AsRef<Path>,
destination: impl AsRef<Path>,
) -> Result<()>
pub async fn decompress_file( &self, source: impl AsRef<Path>, destination: impl AsRef<Path>, ) -> Result<()>
Decompress file
Sourcepub async fn get_active_operations(&self) -> Vec<FileOperationProgress>
pub async fn get_active_operations(&self) -> Vec<FileOperationProgress>
Get active file operations
Sourcepub async fn get_temp_usage(&self) -> Result<(u64, usize)>
pub async fn get_temp_usage(&self) -> Result<(u64, usize)>
Get temp directory usage
Trait Implementations§
Source§impl Debug for FileManager
impl Debug for FileManager
Source§impl Manager for FileManager
impl Manager for FileManager
Source§fn initialize<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn initialize<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Initializes the manager
Source§fn shutdown<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn shutdown<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Shuts down the manager
Source§fn status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ManagerStatus> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ManagerStatus> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns current status
Source§fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = HealthStatus> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = HealthStatus> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Performs health check
Source§fn pause<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn pause<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Pauses the manager
Source§fn resume<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn resume<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Resumes the manager
Source§fn restart<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn restart<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Restarts the manager
Source§fn get_config<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<Value>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn get_config<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<Value>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Gets current configuration
Source§fn update_config<'life0, 'async_trait>(
&'life0 mut self,
_config: Value,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn update_config<'life0, 'async_trait>(
&'life0 mut self,
_config: Value,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Updates configuration
Source§fn dependencies(&self) -> Vec<String>
fn dependencies(&self) -> Vec<String>
Returns dependencies
Source§fn is_essential(&self) -> bool
fn is_essential(&self) -> bool
Checks if manager is essential for system operation
Source§fn description(&self) -> Option<String>
fn description(&self) -> Option<String>
Returns manager description
Source§fn supports_runtime_reload(&self) -> bool
fn supports_runtime_reload(&self) -> bool
Checks if manager supports runtime reloading
Source§fn reload_config<'life0, 'async_trait>(
&'life0 mut self,
_config: Value,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn reload_config<'life0, 'async_trait>(
&'life0 mut self,
_config: Value,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Reloads configuration at runtime
Source§fn required_permissions(&self) -> Vec<String>
fn required_permissions(&self) -> Vec<String>
Returns required permissions
Source§fn platform_requirements(&self) -> PlatformRequirements
fn platform_requirements(&self) -> PlatformRequirements
Returns platform requirements
Auto Trait Implementations§
impl !Freeze for FileManager
impl !RefUnwindSafe for FileManager
impl Send for FileManager
impl Sync for FileManager
impl Unpin for FileManager
impl !UnwindSafe for FileManager
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
Mutably borrows from an owned value. Read more
§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.