summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric/backup/incremental/serializer/SavedIncBackupV0.java
diff options
context:
space:
mode:
authorKeuin <[email protected]>2021-01-23 14:10:32 +0800
committerkeuin <[email protected]>2021-01-23 14:10:32 +0800
commit4a1d885afa7217b47d6183488c3dc6537cef05b6 (patch)
tree1b499db6b834cb0709029e30c0d52c0ddf200ffa /src/main/java/com/keuin/kbackupfabric/backup/incremental/serializer/SavedIncBackupV0.java
parent4ac575330130ac4e1b4b35386ffc0aacd431a5a4 (diff)
Version 1.4.6 (preview): added metadata for incremental backup (need integrated test and display implementation)
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/backup/incremental/serializer/SavedIncBackupV0.java')
-rw-r--r--src/main/java/com/keuin/kbackupfabric/backup/incremental/serializer/SavedIncBackupV0.java64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/backup/incremental/serializer/SavedIncBackupV0.java b/src/main/java/com/keuin/kbackupfabric/backup/incremental/serializer/SavedIncBackupV0.java
new file mode 100644
index 0000000..8b4a4a1
--- /dev/null
+++ b/src/main/java/com/keuin/kbackupfabric/backup/incremental/serializer/SavedIncBackupV0.java
@@ -0,0 +1,64 @@
+package com.keuin.kbackupfabric.backup.incremental.serializer;
+
+import com.keuin.kbackupfabric.backup.incremental.ObjectCollection2;
+import com.keuin.kbackupfabric.backup.name.BackupFileNameEncoder;
+
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.util.Objects;
+
+/**
+ * The old-style incremental backup. Just to keep backward compatibility with old backups.
+ */
+public class SavedIncBackupV0 implements SavedIncrementalBackup {
+
+ private final ObjectCollection2 objectCollection2;
+ private final String backupName;
+ private final LocalDateTime namedBackupTime;
+
+ public SavedIncBackupV0(ObjectCollection2 objectCollection2, BackupFileNameEncoder.BackupBasicInformation backupBasicInformation) {
+ Objects.requireNonNull(objectCollection2);
+ Objects.requireNonNull(backupBasicInformation);
+
+ this.objectCollection2 = objectCollection2;
+ this.backupName = backupBasicInformation.customName;
+ this.namedBackupTime = backupBasicInformation.time;
+ }
+
+
+ @Override
+ public ObjectCollection2 getObjectCollection() {
+ return objectCollection2;
+ }
+
+ @Override
+ public String getBackupName() {
+ return backupName;
+ }
+
+ @Override
+ public ZonedDateTime getBackupTime() {
+ return namedBackupTime.atZone(ZoneId.systemDefault());
+ }
+
+ @Override
+ public int getFilesAdded() {
+ return -1; // missing info
+ }
+
+ @Override
+ public long getTotalSizeBytes() {
+ return -1; // missing info
+ }
+
+ @Override
+ public long getIncreasedSizeBytes() {
+ return -1; // missing info
+ }
+
+ @Override
+ public String toString() {
+ return String.format("(Legacy Backup) %s, created at %s", backupName, namedBackupTime);
+ }
+}