diff --git a/src/Client.java b/src/Client.java deleted file mode 100644 index e62fd9abbbb8f8e2c960b4ac4961b21cff24cb63..0000000000000000000000000000000000000000 --- a/src/Client.java +++ /dev/null @@ -1,12 +0,0 @@ -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 06620e0f1fe6b244bd421db819395eeee90cfe6f..7ab2ca8fcf9be1f37c03c8539fb26b25e7a359a1 100644 --- a/src/Controller.java +++ b/src/Controller.java @@ -3,22 +3,6 @@ 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) @@ -26,5 +10,15 @@ public class Controller { public static void main (String[] args) { + // port to listen on + final int cport = Integer.parseInt(args[0]); + // replication factor => number of Dstores to join + int R = Integer.parseInt(args[1]); + // timeout in milliseconds + int timeout = Integer.parseInt(args[2]); + // how long to wait to start the next rebalance operation + int rebalance_period = Integer.parseInt(args[3]); + + } } \ No newline at end of file diff --git a/src/Dstore.java b/src/Dstore.java index 039ecbdb10ae877b38a85d9b716aeb01d87d44d3..7c65791448ba4df434c45a872d7814525aabe67b 100644 --- a/src/Dstore.java +++ b/src/Dstore.java @@ -1,22 +1,16 @@ 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 static void main (String[] args) { - 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; - } + // port to listen on + final int port = Integer.parseInt(args[0]); + // controller's port to talk to + final int cport = Integer.parseInt(args[1]); + // timeout in milliseconds + int timeout = Integer.parseInt(args[2]); + // where to store the data locally + String file_folder = args[3]; - public static void main (String[] args) { } } \ No newline at end of file