Interface FileSystemBackupService
-
- All Implemented Interfaces:
public interface FileSystemBackupServiceDefines contracts for managing file system-based backup directories. E.g. we might download some input, parse it and process. We'd like to keep the input for some time, say, a week to be able tracing back problems with it if any.
-
-
Method Summary
Modifier and Type Method Description abstract FileprepareNewBackupDir(File rootBackupDir)abstract FilegetLastAvailableBackupDir(File rootBackupDir, Integer ttlInDays)Multiple backup folders might be created by prepareNewBackupDir. abstract Unitbackup(File backupDir, File toBackup, Function1<File, Boolean> toBackupFilter)abstract UnitcleanOutdated(File rootDir, Integer ttlDays)-
-
Method Detail
-
prepareNewBackupDir
abstract 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
abstract 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
abstract 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
abstract Unit cleanOutdated(File rootDir, Integer ttlDays)
-
-
-
-