changeset 1386:dc36dd8bf839

add backup
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 22 Aug 2019 12:32:20 -0600
parents 4d6c1bb8f975
children bc40bc9aab3a
files src/luan/backup/BackupConnection.java src/luan/backup/explanation.txt
diffstat 2 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/luan/backup/BackupConnection.java	Thu Aug 22 12:32:20 2019 -0600
@@ -0,0 +1,17 @@
+package luan.backup;
+
+import java.io.Reader;
+
+
+public interface BackupConnection {
+
+	public static BackupConnection getConnection(String key) {
+		throw new RuntimeException("to be implemented");
+	}
+
+	public boolean isEmpty();
+	public void add(String change);
+	public void split();
+	public void consolidate(Reader snapshot);
+	public Reader get();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/luan/backup/explanation.txt	Thu Aug 22 12:32:20 2019 -0600
@@ -0,0 +1,5 @@
+The interface BackupConnection is for doing continuous backup.  Changes (increments) are added to the backup using add().  This sends the change to the backup machine where it is appended to the currently active file.  By default this would be a file named "backup1.txt".  A call to split() starts a new backup file like "backup2.txt" or whatever the next number is.  If the current file is "backup[N].txt" then calling consolidate(snapshot) replaces backup0.txt through backup[N-1].txt with a new backup0.txt containing the snapshot and then renames backup[N].txt to backup1.txt .  get() returns the concatenation of all files which can be used to reconstruct the data.
+
+This interface hides the implementation details which are significant.  Obviously this has client and server parts.  The client has to be able to deal with the server not being available and should cache changes until the server is available.  The add() and split() calls should be very fast and not block for I/O.  They can just add the request to a queue for processing.
+
+BackupConnection is for documentation purposes only.  It can be changed to a class when implemented.