Added ability to set custom storage to GunSuperPeer

This commit is contained in:
ChronosX88 2019-05-10 12:30:53 +04:00
parent 17dcfc9e7b
commit 5becc5cb8f

View File

@ -2,7 +2,7 @@ package io.github.chronosx88.JGUN.nodes;
import io.github.chronosx88.JGUN.Dispatcher;
import io.github.chronosx88.JGUN.Dup;
import io.github.chronosx88.JGUN.storageBackends.InMemoryGraph;
import io.github.chronosx88.JGUN.storageBackends.StorageBackend;
import org.java_websocket.WebSocket;
import org.java_websocket.handshake.ClientHandshake;
import org.java_websocket.server.WebSocketServer;
@ -12,13 +12,14 @@ import java.net.InetSocketAddress;
public class GunSuperPeer extends WebSocketServer implements Peer {
private Dup dup = new Dup();
private InMemoryGraph graph = new InMemoryGraph();
private StorageBackend graph;
private Dispatcher dispatcher;
public GunSuperPeer(int port) {
public GunSuperPeer(int port, StorageBackend storageBackend) {
super(new InetSocketAddress(port));
setReuseAddr(true);
dispatcher = new Dispatcher(graph, this, dup);
this.graph = storageBackend;
}
@Override