mirror of
https://github.com/ChronosX88/JGUN.git
synced 2024-11-21 22:12:18 +00:00
Added ability to set custom storage to GunSuperPeer
This commit is contained in:
parent
17dcfc9e7b
commit
5becc5cb8f
@ -2,7 +2,7 @@ package io.github.chronosx88.JGUN.nodes;
|
|||||||
|
|
||||||
import io.github.chronosx88.JGUN.Dispatcher;
|
import io.github.chronosx88.JGUN.Dispatcher;
|
||||||
import io.github.chronosx88.JGUN.Dup;
|
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.WebSocket;
|
||||||
import org.java_websocket.handshake.ClientHandshake;
|
import org.java_websocket.handshake.ClientHandshake;
|
||||||
import org.java_websocket.server.WebSocketServer;
|
import org.java_websocket.server.WebSocketServer;
|
||||||
@ -12,13 +12,14 @@ import java.net.InetSocketAddress;
|
|||||||
|
|
||||||
public class GunSuperPeer extends WebSocketServer implements Peer {
|
public class GunSuperPeer extends WebSocketServer implements Peer {
|
||||||
private Dup dup = new Dup();
|
private Dup dup = new Dup();
|
||||||
private InMemoryGraph graph = new InMemoryGraph();
|
private StorageBackend graph;
|
||||||
private Dispatcher dispatcher;
|
private Dispatcher dispatcher;
|
||||||
|
|
||||||
public GunSuperPeer(int port) {
|
public GunSuperPeer(int port, StorageBackend storageBackend) {
|
||||||
super(new InetSocketAddress(port));
|
super(new InetSocketAddress(port));
|
||||||
setReuseAddr(true);
|
setReuseAddr(true);
|
||||||
dispatcher = new Dispatcher(graph, this, dup);
|
dispatcher = new Dispatcher(graph, this, dup);
|
||||||
|
this.graph = storageBackend;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user