From 912d379f53c43e8fbf73dd7124f96024eda5f2c1 Mon Sep 17 00:00:00 2001
From: Theodora-Mara Pislar <tmp1u19@soton.ac.uk>
Date: Sun, 25 Apr 2021 23:03:44 +0100
Subject: [PATCH] Add the skeleton of the java classes needed for this project

---
 src/Client.java     | 12 ++++++++++++
 src/Controller.java | 26 ++++++++++++++++++++++++++
 src/Dstore.java     | 18 ++++++++++++++++++
 3 files changed, 56 insertions(+)
 create mode 100644 src/Client.java

diff --git a/src/Client.java b/src/Client.java
new file mode 100644
index 0000000..e62fd9a
--- /dev/null
+++ b/src/Client.java
@@ -0,0 +1,12 @@
+public class Client {
+
+    // controller port to communicate with
+    int cport;
+    // timeout in milliseconds
+    long timeout;
+
+    public Client(int cport, long timeout) {
+        this.cport = cport;
+        this.timeout = timeout;
+    }
+}
\ No newline at end of file
diff --git a/src/Controller.java b/src/Controller.java
index e69de29..5e258c3 100644
--- a/src/Controller.java
+++ b/src/Controller.java
@@ -0,0 +1,26 @@
+import java.io.*;
+import java.net.*;
+
+public class Controller {
+
+    // port to listen on
+    private int cport;
+    // replication factor => number of Dstores to join
+    private int R;
+    // timeout in milliseconds
+    private long timeout;
+    // how long to wait to start the next rebalance operation
+    private long rebalance_period;
+
+    public Controller (int cport, int R, long timeout, long rebalance_period) {
+        this.cport = cport;
+        this.R = R;
+        this.timeout = timeout;
+        this.rebalance_period = rebalance_period;
+    }
+
+    // orchestrates client requests
+    // maintains an index with the allocation of files to Dstores
+    // waits for Dstores to join the datastore (rebalance operation)
+    // it doesn't serve any client request until at least R Dstores have joined the system
+}
\ No newline at end of file
diff --git a/src/Dstore.java b/src/Dstore.java
index e69de29..20bfc0c 100644
--- a/src/Dstore.java
+++ b/src/Dstore.java
@@ -0,0 +1,18 @@
+public class Dstore {
+
+    // port to listen on
+    int port;
+    // controller's port to talk to
+    int cport;
+    // timeout in milliseconds
+    long timeout;
+    // where to store the data locally
+    String file_folder;
+
+    public Dstore (int port, int cport, long timeout, String file_folder) {
+        this.port = port;
+        this.cport = cport;
+        this.timeout = timeout;
+        this. file_folder = file_folder;
+    }
+}
\ No newline at end of file
-- 
GitLab