Class FileSystemBackupServiceImpl
-
- All Implemented Interfaces:
-
tech.harmonysoft.oss.common.backup.file.FileSystemBackupService
@Named() public final class FileSystemBackupServiceImpl implements FileSystemBackupService
-
-
Constructor Summary
Constructors Constructor Description FileSystemBackupServiceImpl(ClockProvider clockProvider, DateTimeHelper dateTimeHelper)
-
Method Summary
Modifier and Type Method Description FileprepareNewBackupDir(File rootBackupDir)FilegetLastAvailableBackupDir(File rootBackupDir, Integer ttlInDays)Multiple backup folders might be created by prepareNewBackupDir. Unitbackup(File backupDir, File toBackup, Function1<File, Boolean> toBackupFilter)UnitcleanOutdated(File rootDir, Integer ttlDays)-
-
Constructor Detail
-
FileSystemBackupServiceImpl
FileSystemBackupServiceImpl(ClockProvider clockProvider, DateTimeHelper dateTimeHelper)
-
-
Method Detail
-
prepareNewBackupDir
File prepareNewBackupDir(File rootBackupDir)
- Returns:
backup dir for the given base dir. It's up to underlying implementation to define how backups should be organised internally, the only requirement is that when cleanOutdated is called, it should remove all backups which are older than the given ttl
-
getLastAvailableBackupDir
File getLastAvailableBackupDir(File rootBackupDir, Integer ttlInDays)
Multiple backup folders might be created by prepareNewBackupDir. This method tries to find the most recent one created within given ttl.
-
backup
Unit backup(File backupDir, File toBackup, Function1<File, Boolean> toBackupFilter)
- Parameters:
backupDir- backup directory to store the datatoBackup- file or root directory to back up at the given backup dirtoBackupFilter- when this method is asked to back up a directory, we might want to filter the input and store only subset of its files.
-
cleanOutdated
Unit cleanOutdated(File rootDir, Integer ttlDays)
-
-
-
-