summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/PrimitiveBackupFeedback.java
diff options
context:
space:
mode:
authorKeuin <[email protected]>2021-01-13 12:51:15 +0800
committerkeuin <[email protected]>2021-01-13 12:51:15 +0800
commit81497ebee2cdb0dac3bcdc26c5d77d06bdb98b5d (patch)
tree9e7aad680a438b845126b266374155c8fb306179 /src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/PrimitiveBackupFeedback.java
parentf4d926c1eb91749a4b0f89c7a35538821ff7e21b (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.java29
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 "";
+ }
+}