BackUp management
Introduction
This document specifices the implementation of features for the BackUp capability.
Related Backlog items
#340 BACKUP: new screen, first feature: link Catalogs
#675 BACKUP: Generate LuckyBackup profile from BackUp links
Existing Features & Architecture
Katalog enables the definition of links between Catalogs, defining one as Source and the other as Target.
This help checking the coverage of backup for devices, and compare source and backup target size, number of files and date updated.
see: BackUp
Table device_mapping
CREATE TABLE device_mapping(
mapping_id INTEGER PRIMARY KEY AUTOINCREMENT,
mapping_name TEXT,
mapping_type TEXT,
mapping_device_source_id NUMERIC,
mapping_device_target_id NUMERIC,
mapping_backup_last_date TEXT,
mapping_backup_last_size TEXT
)
Device Properties (from code):
device_id,device_name,device_path,device_typedevice_active(bool - indicates if path is reachable)device_total_file_size,device_total_file_countdevice_date_updated- Device with
type='Catalog'represents indexed directories
UI Components:
mainwindow_tab_backup.cpp- BackUp screen implementation- TreeViews for Source/Target selection
- TableView for mapping display with comparison metrics
- Buttons: SaveMapping, DeleteMapping, Reload lists
To be considered for new developments:
- Backend/UI separation
- KJob pattern to make long operations stoppable (DeviceUpdateManager)
- KF6 libraries available
- Cross-platform considerations (Linux/Windows/macOS)
- Qt6 with QProcess for external commands
#675 Generate LuckyBackUp profile
Goal
Generate LuckyBackup .profile files from Katalog's backup links.
This should faciliate the maintenace and alignment of the profile
Principles
- A Catalog is a device associated with a folder, to index the related list of files. This is the original indexed path (catalog_file_path) to be used as Source or Target (Destination in LuckyBackup).
- Active state handling, if source/target is not active (path unreachable): this does not matter to generate a profile, LuckyBackup checks active state before executing > always generate the profile.
- Multiple associations: create one profile with multiple tasks; 1 task per Katalog's backup link.
Profile definition
Profile naming:
- Name = "Katalog_" + timestamp
- Note for later (do not develop): Consider giving the profile name to overwrite it.
File locations: generated profiles shall be saved in default folder
~/.luckybackup/profiles/
Note: alternative (do not develop) could be Katalog collection folder or another user choice.
File type & name
The profile is a simlple text file, with a .profile extension
Profile path example
~/.luckybackup/profiles/Katalog_20251120085033.profile
Link & Task mapping definition
Katalog LuckyBackup
mapping_name → Task name
device_path (source) → Task source directory
device_path (target) → Task destination directory
mapping_type → Backup type (currently always "Backup" giving Type: "BackUp Source inside Destination")
Profile template
Created from an empty profile. 2 tasks created:
- Source=/home/stephane/Developments/Katalog/Collections/TESTS/670_backup_mappings/source_folder_1 , Destination=/home/stephane/Developments/Katalog/Collections/TESTS/670_backup_mappings/target_folder_1
- Source=/home/stephane/Developments/Katalog/Collections/TESTS/670_backup_mappings/source_folder_2 , Destination=/home/stephane/Developments/Katalog/Collections/TESTS/670_backup_mappings/target_folder_2
Consider that all these hereafter are required basic backup profile and tasks
List of fields & value to adjust:
- Name
- Source
- Destination
- Args
- Args
- LuckyBackupDir=/home/stephane/.luckyBackup/
LuckyBackupDir: replace stephane by the user name
***************************** WARNING *****************************
Do NOT edit this file directly, unless you REALLY know what you are doing !!
[profile_global]
appName=luckyBackup
appVersion=0.5
TotalTasks=2
[email]
emailCommand=
emailArguments=
emailSubject=luckyBackup report
emailNever=1
emailError=0
emailSchedule=0
emailTLS=0
emailFrom=
emailTo=
emailSMTP=
emailBody=Profile: %p
emailBody=Date: %d
emailBody=Time: %i
emailBody=Errors found: %e
[Task] - 0
Name=BackUpTask1
TypeDirContents=0
TypeDirName=1
TypeSync=0
Source=/home/stephane/Developments/Katalog/Collections/TESTS/670_backup_mappings/source_folder_1
Destination=/home/stephane/Developments/Katalog/Collections/TESTS/670_backup_mappings/target_folder_1/
LastExecutionTime=
LastExecutionErrors=-1
Args=-h
Args=--progress
Args=--stats
Args=-r
Args=-tgo
Args=-p
Args=-l
Args=-D
Args=--update
Args=--delete-after
Args=--filter=protect .luckybackup-snaphots/
Args=/home/stephane/Developments/Katalog/Collections/TESTS/670_backup_mappings/source_folder_1
Args=/home/stephane/Developments/Katalog/Collections/TESTS/670_backup_mappings/target_folder_1/
ConnectRestore=
KeepSnapshots=1
Exclude=0
ExcludeFromFile=0
ExcludeFile=
ExcludeTemp=0
ExcludeCache=0
ExcludeBackup=0
ExcludeMount=0
ExcludeLostFound=0
ExcludeSystem=0
ExcludeTrash=0
ExcludeGVFS=0
Include=0
IncludeFromFile=0
IncludeModeNormal=1
IncludeFile=
Remote=0
RemoteModule=0
RemoteDestination=1
RemoteSource=0
RemoteSSH=0
RemoteHost=
RemoteUser=
RemotePassword=
RemoteSSHPassword=
RemoteSSHPasswordStr=
RemoteSSHOptions=
RemoteSSHPort=0
OptionsUpdate=1
OptionsDelete=1
OptionsRecurse=1
OptionsOwnership=1
OptionsSymlinks=1
OptionsPermissions=1
OptionsDevices=1
OptionsCVS=0
OptionsHardLinks=0
OptionsFATntfs=0
OptionsSuper=0
OptionsNumericIDs=0
OptionsRestorent=0
OptionsVss=0
LuckyBackupDir=/home/stephane/.luckyBackup/
VshadowDir=/usr/bin
RsyncCommand=rsync
SshCommand=ssh
DosdevCommand=/usr/bin/dosdev.exe
CygpathCommand=/usr/bin/cygpath.exe
TempPath=/tmp
ByPassWarning=0
CloneWarning=1
RepeatOnFail=0
IncludeState=0
[Task_end] - 0
[Task] - 1
Name=BackUpTask2
TypeDirContents=0
TypeDirName=1
TypeSync=0
Source=/home/stephane/Developments/Katalog/Collections/TESTS/670_backup_mappings/source_folder_2
Destination=/home/stephane/Developments/Katalog/Collections/TESTS/670_backup_mappings/target_folder_2/
LastExecutionTime=
LastExecutionErrors=-1
Args=-h
Args=--progress
Args=--stats
Args=-r
Args=-tgo
Args=-p
Args=-l
Args=-D
Args=--update
Args=--delete-after
Args=--filter=protect .luckybackup-snaphots/
Args=/home/stephane/Developments/Katalog/Collections/TESTS/670_backup_mappings/source_folder_2
Args=/home/stephane/Developments/Katalog/Collections/TESTS/670_backup_mappings/target_folder_2/
ConnectRestore=
KeepSnapshots=1
Exclude=0
ExcludeFromFile=0
ExcludeFile=
ExcludeTemp=0
ExcludeCache=0
ExcludeBackup=0
ExcludeMount=0
ExcludeLostFound=0
ExcludeSystem=0
ExcludeTrash=0
ExcludeGVFS=0
Include=0
IncludeFromFile=0
IncludeModeNormal=1
IncludeFile=
Remote=0
RemoteModule=0
RemoteDestination=1
RemoteSource=0
RemoteSSH=0
RemoteHost=
RemoteUser=
RemotePassword=
RemoteSSHPassword=
RemoteSSHPasswordStr=
RemoteSSHOptions=
RemoteSSHPort=0
OptionsUpdate=1
OptionsDelete=1
OptionsRecurse=1
OptionsOwnership=1
OptionsSymlinks=1
OptionsPermissions=1
OptionsDevices=1
OptionsCVS=0
OptionsHardLinks=0
OptionsFATntfs=0
OptionsSuper=0
OptionsNumericIDs=0
OptionsRestorent=0
OptionsVss=0
LuckyBackupDir=/home/stephane/.luckyBackup/
VshadowDir=/usr/bin
RsyncCommand=rsync
SshCommand=ssh
DosdevCommand=/usr/bin/dosdev.exe
CygpathCommand=/usr/bin/cygpath.exe
TempPath=/tmp
ByPassWarning=0
CloneWarning=1
RepeatOnFail=0
IncludeState=0
[Task_end] - 1
[profile end]
Error handling
The only required part is the folder ~/.luckyBackup/profiles/
Create it if it does not exists.
No need to consider if LuckyBackup is installed or not.
UI implementation
Consider button and on clicked method:
void MainWindow::on_BackUp_pushButton_GenerateLuckyBackupProfile_clicked()
{
}
#000 LuckyBackup task triggering
DO NOT cover yet.
#000 LuckyBackup task triggering
DO NOT cover yet.
#000 Native BackUp execution
Goals
- Full backup within Katalog (rsync-based is 1 possbility, to be investigated and confirmed)
- No external dependencies (except rsync if retained)
- Cross-platform support
- KDE integration (KJob, notifications) (consider KBackUp)
Architecture Vision
Backend Classes:
// src/backup/backupengine.h
class BackupEngine : public QObject {
// rsync wrapper
// Incremental backup logic
// Snapshot management
};
// src/backup/backupjob.h
class BackupJob : public KJob {
// KF6 KJob pattern for UI integration
// Progress reporting
// Cancellation support
};
// src/backup/backupmanager.h
class BackupManager : public QObject {
// Orchestrates multiple backup operations
// Schedule management
// History tracking
};
Features Roadmap:
- Basic file copy (rsync)
- Incremental backups
- Snapshot management
- Exclude/include patterns
- Progress tracking
- Scheduling (cron/systemd/Task Scheduler)
- Restore functionality
- Compression options
- Remote backups (ssh)
- Verification