The Distributed Map consists in a Distributed Key Value store built using Java. It was built using CompletableFuture and concepts like Causal Ordering. The keys consist in long
values and each key has a respective value which is an byte[]
. The usage of the Distributed Map is simplified with the usage of our Distributed Map API.
The available API has 2 methods:
This methods receives a Map<Long,byte[]>
as parameter and stores the data in the respective servers.
CompletableFuture<Void> put(Map<Long,byte[]> values)
This methods receives a Collection<Long>
containing keys as parameter and retrieves the data from the respective servers.
CompletableFuture<Map<Long,byte[]>> get(Collection<Long> keys)
The distribution of keys and values between the servers is done using a hash function, that returns the number of a server given a key. Each put
or get
request uses this hash function. Every operation is translated to a Request
which is sent via AsynchronousSocketChannels
to our servers. Every Request
needs to contact the ClockServer
in order to get a "ticket". This is used to assure some properties like causal ordering.
The first step is to setup the servers anda the ClockServer
. Each server has a argument to specify it's number (-n 0
, -n 1
, ...) . The numbering system start with 0 and needs to be sequential. The ClockServer
has no arguments.
After setting up th servers you can import the API and use the DistributedMap
object as you wish:
DistributedMap dm = new DistributedMap();
...
dm.put(...);
dm.get(...);