Class BackupService
Runs on an async repeating timer at the configured interval and writes a fresh
file via EnderChestStorage.backup(Path) (SQLite VACUUM INTO — consistent even while
players are saving, so the hot path is never paused). Only the file-based SQLite backend supports
this; for remote backends EnderChestStorage.supportsBackup() is false and the service logs
a one-time warning and stays idle (those should be backed up with the DB server's own tooling).
After each snapshot the backups/ folder is pruned to the most recent keep files
(keep <= 0 keeps everything). Snapshot names embed a sortable timestamp so lexical order is
chronological order. Everything runs off the region/main thread; failures are logged, never thrown,
so a bad backup can never take the server down or corrupt the live DB.
-
Constructor Summary
ConstructorsConstructorDescriptionBackupService(EnderChestStorage storage, Scheduler scheduler, org.slf4j.Logger logger, Telemetry telemetry, Path dataFolder, boolean enabled, long intervalMillis, int keep, String folderName, String backendName) -
Method Summary
Modifier and TypeMethodDescriptionvoidRuns one snapshot off-thread immediately (used for the optional on-startup backup).voidreschedule(boolean newEnabled, long newIntervalMillis, int newKeep) Re-applies possibly-changed backup settings after a/ee reload.voidstart()Starts the repeating async backup, if enabled and the backend supports file snapshots.voidstop()Cancels the repeating backup.
-
Constructor Details
-
BackupService
-
-
Method Details
-
start
public void start()Starts the repeating async backup, if enabled and the backend supports file snapshots. -
backupNowAsync
public void backupNowAsync()Runs one snapshot off-thread immediately (used for the optional on-startup backup). -
reschedule
public void reschedule(boolean newEnabled, long newIntervalMillis, int newKeep) Re-applies possibly-changed backup settings after a/ee reload. A changed retention count takes effect on the next prune without touching the timer; a changed enabled flag or interval restarts the timer (cancelling the old one — never more than one live task, so no leak). The backup folder is bound at startup and a change to it requires a restart. -
stop
public void stop()Cancels the repeating backup. Safe to call even if never started.
-