Class BackupRunner
All of the backup feature's behavior lives here, in a plain object with no Spring or Quartz
dependency, so it can be exercised directly; BackupJob is a thin scheduler adapter over
it, and CortexBackupAutoConfiguration is the only thing that knows how it is scheduled.
The local backup file is deliberately left in place after a successful upload: the copy in S3 is a copy, not a move, so a bucket misconfiguration can never be silently destructive. Backups therefore accumulate beside the store, and pruning them is left to whatever manages that volume.
Failures propagate rather than being logged and swallowed — a backup that silently stopped
working would be worse than one that fails loudly, and BackupJob is where the decision to
report rather than retry is made.
-
Constructor Summary
ConstructorsConstructorDescriptionBackupRunner(ai.chatur.cortex.core.store.BackupService backupService, software.amazon.awssdk.services.s3.S3Client s3Client, String bucket, String keyPrefix) Creates the runner. -
Method Summary
-
Constructor Details
-
BackupRunner
public BackupRunner(ai.chatur.cortex.core.store.BackupService backupService, software.amazon.awssdk.services.s3.S3Client s3Client, String bucket, String keyPrefix) Creates the runner.- Parameters:
backupService- takes the TDB2 snapshots3Client- the client the snapshot is uploaded throughbucket- the bucket to upload tokeyPrefix- prepended verbatim to the backup's file name to form the object key
-
-
Method Details
-
run
public void run()Takes a backup and uploads it.The object key is
cortex.backup.key-prefixfollowed by the file's name. TDB2 already makes that name unique per backup (backup_<yyyy-MM-dd_HHmmss>.nq.gz), so an upload never overwrites an earlier one.- Throws:
RuntimeException- if the backup cannot be taken or the upload fails
-