diff options
author | Keuin <[email protected]> | 2021-01-13 12:51:15 +0800 |
---|---|---|
committer | keuin <[email protected]> | 2021-01-13 12:51:15 +0800 |
commit | 81497ebee2cdb0dac3bcdc26c5d77d06bdb98b5d (patch) | |
tree | 9e7aad680a438b845126b266374155c8fb306179 /src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/PrimitiveBackupFeedback.java | |
parent | f4d926c1eb91749a4b0f89c7a35538821ff7e21b (diff) |
Clean old incremental backup codes.
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/PrimitiveBackupFeedback.java')
-rw-r--r-- | src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/PrimitiveBackupFeedback.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/PrimitiveBackupFeedback.java b/src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/PrimitiveBackupFeedback.java new file mode 100644 index 0000000..6d7a15b --- /dev/null +++ b/src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/PrimitiveBackupFeedback.java @@ -0,0 +1,29 @@ +package com.keuin.kbackupfabric.operation.backup.feedback; + +import static com.keuin.kbackupfabric.util.backup.BackupFilesystemUtil.getFriendlyFileSizeString; + +public class PrimitiveBackupFeedback implements BackupFeedback { + private final boolean success; + private final long backupSizeBytes; + + public PrimitiveBackupFeedback(boolean success, long backupSizeBytes) { + this.success = success; + this.backupSizeBytes = backupSizeBytes; + } + + public boolean isSuccess() { + return success; + } + + public long getBackupSizeBytes() { + return backupSizeBytes; + } + + @Override + public String getFeedback() { + if (success && backupSizeBytes >= 0) + return String.format(" File size: %s.", getFriendlyFileSizeString(backupSizeBytes)); + else + return ""; + } +} |