pub struct FileRoller { /* private fields */ }Expand description
File roller for managing file rotation based on configurable policies
Implementations§
Source§impl FileRoller
impl FileRoller
Sourcepub fn new(
base_path: PathBuf,
max_file_size_mb: u64,
max_records_per_file: u64,
retention_days: u32,
) -> Self
pub fn new( base_path: PathBuf, max_file_size_mb: u64, max_records_per_file: u64, retention_days: u32, ) -> Self
Create a new file roller with specified policies
Sourcepub fn register_active_file(&self, writer_id: String, file_path: PathBuf)
pub fn register_active_file(&self, writer_id: String, file_path: PathBuf)
Register a new active file for rotation management
Sourcepub fn update_file_statistics(
&self,
writer_id: &str,
size_delta: u64,
record_delta: u64,
)
pub fn update_file_statistics( &self, writer_id: &str, size_delta: u64, record_delta: u64, )
Update statistics for an active file
Sourcepub fn check_rotation_policy(&self, writer_id: &str) -> bool
pub fn check_rotation_policy(&self, writer_id: &str) -> bool
Check if a file needs rotation based on configured policies
Sourcepub async fn execute_rotation_check(&self) -> Result<Vec<String>>
pub async fn execute_rotation_check(&self) -> Result<Vec<String>>
Execute rotation for all files that meet rotation criteria
Sourcepub async fn cleanup_old_files(&self) -> Result<u64>
pub async fn cleanup_old_files(&self) -> Result<u64>
Clean up old files based on retention policy
Sourcepub fn get_active_files_statistics(&self) -> FxHashMap<String, ActiveFileInfo>
pub fn get_active_files_statistics(&self) -> FxHashMap<String, ActiveFileInfo>
Get statistics for all currently active files
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FileRoller
impl !RefUnwindSafe for FileRoller
impl Send for FileRoller
impl Sync for FileRoller
impl Unpin for FileRoller
impl !UnwindSafe for FileRoller
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