Struct FileManager

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

Main file manager

Implementations§

Source§

impl FileManager

Source

pub fn new(config: FileConfig) -> Self

Create a new file manager

Source

pub fn set_event_bus(&mut self, event_bus: Arc<EventBusManager>)

Set event bus for publishing file events

Source

pub async fn read_file(&self, path: impl AsRef<Path>) -> Result<Vec<u8>>

Read file contents

Source

pub async fn read_file_to_string( &self, path: impl AsRef<Path>, ) -> Result<String>

Read file contents as string

Source

pub async fn write_file( &self, path: impl AsRef<Path>, data: &[u8], options: Option<FileOperationOptions>, ) -> Result<()>

Write data to file

Source

pub async fn copy_file( &self, source: impl AsRef<Path>, destination: impl AsRef<Path>, options: Option<FileOperationOptions>, ) -> Result<u64>

Copy file

Source

pub async fn move_file( &self, source: impl AsRef<Path>, destination: impl AsRef<Path>, options: Option<FileOperationOptions>, ) -> Result<()>

Move/rename file

Source

pub async fn delete_file(&self, path: impl AsRef<Path>) -> Result<()>

Delete file

Source

pub async fn create_directory( &self, path: impl AsRef<Path>, recursive: bool, ) -> Result<()>

Create directory

Source

pub async fn delete_directory( &self, path: impl AsRef<Path>, recursive: bool, ) -> Result<()>

Delete directory

Source

pub async fn list_directory( &self, path: impl AsRef<Path>, ) -> Result<Vec<FileMetadata>>

List directory contents

Source

pub async fn get_metadata(&self, path: impl AsRef<Path>) -> Result<FileMetadata>

Get file metadata

Source

pub async fn exists(&self, path: impl AsRef<Path>) -> bool

Check if file exists

Source

pub async fn file_size(&self, path: impl AsRef<Path>) -> Result<u64>

Get file size

Source

pub async fn create_temp_file( &self, prefix: Option<&str>, suffix: Option<&str>, ) -> Result<PathBuf>

Create temporary file

Source

pub async fn cleanup_temp_files(&self, max_age: Duration) -> Result<u64>

Clean up temporary files

Source

pub async fn watch_path( &mut self, path: impl AsRef<Path>, recursive: bool, ) -> Result<()>

Start watching a path for changes

Source

pub async fn unwatch_path(&mut self, path: impl AsRef<Path>) -> Result<()>

Stop watching a path

Source

pub fn subscribe_to_changes(&self) -> Option<Receiver<FileChangeEvent>>

Subscribe to file change events

Source

pub async fn compress_file( &self, source: impl AsRef<Path>, destination: impl AsRef<Path>, ) -> Result<()>

Compress file using configured compression

Source

pub async fn decompress_file( &self, source: impl AsRef<Path>, destination: impl AsRef<Path>, ) -> Result<()>

Decompress file

Source

pub async fn get_active_operations(&self) -> Vec<FileOperationProgress>

Get active file operations

Source

pub async fn get_temp_usage(&self) -> Result<(u64, usize)>

Get temp directory usage

Trait Implementations§

Source§

impl Debug for FileManager

Source§

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

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

impl Manager for FileManager

Source§

fn name(&self) -> &str

Returns the manager name
Source§

fn id(&self) -> Uuid

Returns the manager ID
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,

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,

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,

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,

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,

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,

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,

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,

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,

Updates configuration
Source§

fn dependencies(&self) -> Vec<String>

Returns dependencies
Source§

fn priority(&self) -> i32

Returns initialization priority
Source§

fn is_essential(&self) -> bool

Checks if manager is essential for system operation
Source§

fn version(&self) -> Option<String>

Returns manager version
Source§

fn description(&self) -> Option<String>

Returns manager description
Source§

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,

Reloads configuration at runtime
Source§

fn required_permissions(&self) -> Vec<String>

Returns required permissions
Source§

fn platform_requirements(&self) -> PlatformRequirements

Returns platform requirements

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> InitializeFromFunction<T> for T

§

fn initialize_from_function(f: fn() -> T) -> T

Create an instance of this type from an initialization function
§

impl<T> Instrument for T

§

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

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

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.

§

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
§

impl<Ret> SpawnIfAsync<(), Ret> for Ret

§

fn spawn(self) -> Ret

Spawn the value into the dioxus runtime if it is an async block
§

impl<T, O> SuperFrom<T> for O
where O: From<T>,

§

fn super_from(input: T) -> O

Convert from a type to another type.
§

impl<T, O, M> SuperInto<O, M> for T
where O: SuperFrom<T, M>,

§

fn super_into(self) -> O

Convert from a type to another type.
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<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> PlatformSync for T
where T: Send + Sync,