mirror of
https://github.com/ChronosX88/KademliaDHT.git
synced 2024-11-24 19:22:18 +00:00
Updated the operations to use the KademliaNode interface rather than the JKademliaNode class
This commit is contained in:
parent
a1faffb4d9
commit
e8105a9e33
@ -1,9 +1,9 @@
|
||||
package kademlia.operation;
|
||||
|
||||
import java.io.IOException;
|
||||
import kademlia.JKademliaNode;
|
||||
import kademlia.KadConfiguration;
|
||||
import kademlia.KadServer;
|
||||
import kademlia.KademliaNode;
|
||||
import kademlia.node.KademliaId;
|
||||
|
||||
/**
|
||||
@ -17,10 +17,10 @@ public class BucketRefreshOperation implements Operation
|
||||
{
|
||||
|
||||
private final KadServer server;
|
||||
private final JKademliaNode localNode;
|
||||
private final KademliaNode localNode;
|
||||
private final KadConfiguration config;
|
||||
|
||||
public BucketRefreshOperation(KadServer server, JKademliaNode localNode, KadConfiguration config)
|
||||
public BucketRefreshOperation(KadServer server, KademliaNode localNode, KadConfiguration config)
|
||||
{
|
||||
this.server = server;
|
||||
this.localNode = localNode;
|
||||
|
@ -10,6 +10,7 @@ import java.io.IOException;
|
||||
import kademlia.JKademliaNode;
|
||||
import kademlia.KadConfiguration;
|
||||
import kademlia.KadServer;
|
||||
import kademlia.KademliaNode;
|
||||
import kademlia.exceptions.RoutingException;
|
||||
import kademlia.message.AcknowledgeMessage;
|
||||
import kademlia.message.ConnectMessage;
|
||||
@ -22,7 +23,7 @@ public class ConnectOperation implements Operation, Receiver
|
||||
public static final int MAX_CONNECT_ATTEMPTS = 5; // Try 5 times to connect to a node
|
||||
|
||||
private final KadServer server;
|
||||
private final JKademliaNode localNode;
|
||||
private final KademliaNode localNode;
|
||||
private final Node bootstrapNode;
|
||||
private final KadConfiguration config;
|
||||
|
||||
@ -35,7 +36,7 @@ public class ConnectOperation implements Operation, Receiver
|
||||
* @param bootstrap Node to use to bootstrap the local node onto the network
|
||||
* @param config
|
||||
*/
|
||||
public ConnectOperation(KadServer server, JKademliaNode local, Node bootstrap, KadConfiguration config)
|
||||
public ConnectOperation(KadServer server, KademliaNode local, Node bootstrap, KadConfiguration config)
|
||||
{
|
||||
this.server = server;
|
||||
this.localNode = local;
|
||||
|
@ -2,9 +2,9 @@ package kademlia.operation;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import kademlia.JKademliaNode;
|
||||
import kademlia.KadConfiguration;
|
||||
import kademlia.KadServer;
|
||||
import kademlia.KademliaNode;
|
||||
import kademlia.dht.KademliaDHT;
|
||||
import kademlia.dht.StorageEntryMetadata;
|
||||
import kademlia.exceptions.ContentNotFoundException;
|
||||
@ -22,11 +22,11 @@ public class ContentRefreshOperation implements Operation
|
||||
{
|
||||
|
||||
private final KadServer server;
|
||||
private final JKademliaNode localNode;
|
||||
private final KademliaNode localNode;
|
||||
private final KademliaDHT dht;
|
||||
private final KadConfiguration config;
|
||||
|
||||
public ContentRefreshOperation(KadServer server, JKademliaNode localNode, KademliaDHT dht, KadConfiguration config)
|
||||
public ContentRefreshOperation(KadServer server, KademliaNode localNode, KademliaDHT dht, KadConfiguration config)
|
||||
{
|
||||
this.server = server;
|
||||
this.localNode = localNode;
|
||||
|
@ -1,9 +1,9 @@
|
||||
package kademlia.operation;
|
||||
|
||||
import java.io.IOException;
|
||||
import kademlia.JKademliaNode;
|
||||
import kademlia.KadConfiguration;
|
||||
import kademlia.KadServer;
|
||||
import kademlia.KademliaNode;
|
||||
import kademlia.dht.KademliaDHT;
|
||||
|
||||
/**
|
||||
@ -16,11 +16,11 @@ public class KadRefreshOperation implements Operation
|
||||
{
|
||||
|
||||
private final KadServer server;
|
||||
private final JKademliaNode localNode;
|
||||
private final KademliaNode localNode;
|
||||
private final KademliaDHT dht;
|
||||
private final KadConfiguration config;
|
||||
|
||||
public KadRefreshOperation(KadServer server, JKademliaNode localNode, KademliaDHT dht, KadConfiguration config)
|
||||
public KadRefreshOperation(KadServer server, KademliaNode localNode, KademliaDHT dht, KadConfiguration config)
|
||||
{
|
||||
this.server = server;
|
||||
this.localNode = localNode;
|
||||
|
@ -8,9 +8,9 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import kademlia.JKademliaNode;
|
||||
import kademlia.KadConfiguration;
|
||||
import kademlia.KadServer;
|
||||
import kademlia.KademliaNode;
|
||||
import kademlia.exceptions.RoutingException;
|
||||
import kademlia.message.Message;
|
||||
import kademlia.message.NodeLookupMessage;
|
||||
@ -37,7 +37,7 @@ public class NodeLookupOperation implements Operation, Receiver
|
||||
private static final String FAILED = "Failed";
|
||||
|
||||
private final KadServer server;
|
||||
private final JKademliaNode localNode;
|
||||
private final KademliaNode localNode;
|
||||
private final KadConfiguration config;
|
||||
|
||||
private final Message lookupMessage; // Message sent to each peer
|
||||
@ -60,7 +60,7 @@ public class NodeLookupOperation implements Operation, Receiver
|
||||
* @param lookupId The ID for which to find nodes close to
|
||||
* @param config
|
||||
*/
|
||||
public NodeLookupOperation(KadServer server, JKademliaNode localNode, KademliaId lookupId, KadConfiguration config)
|
||||
public NodeLookupOperation(KadServer server, KademliaNode localNode, KademliaId lookupId, KadConfiguration config)
|
||||
{
|
||||
this.server = server;
|
||||
this.localNode = localNode;
|
||||
|
@ -2,9 +2,9 @@ package kademlia.operation;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import kademlia.JKademliaNode;
|
||||
import kademlia.KadConfiguration;
|
||||
import kademlia.KadServer;
|
||||
import kademlia.KademliaNode;
|
||||
import kademlia.dht.KademliaDHT;
|
||||
import kademlia.dht.KademliaStorageEntry;
|
||||
import kademlia.message.Message;
|
||||
@ -21,7 +21,7 @@ public class StoreOperation implements Operation
|
||||
{
|
||||
|
||||
private final KadServer server;
|
||||
private final JKademliaNode localNode;
|
||||
private final KademliaNode localNode;
|
||||
private final KademliaStorageEntry storageEntry;
|
||||
private final KademliaDHT localDht;
|
||||
private final KadConfiguration config;
|
||||
@ -33,7 +33,7 @@ public class StoreOperation implements Operation
|
||||
* @param localDht The local DHT
|
||||
* @param config
|
||||
*/
|
||||
public StoreOperation(KadServer server, JKademliaNode localNode, KademliaStorageEntry storageEntry, KademliaDHT localDht, KadConfiguration config)
|
||||
public StoreOperation(KadServer server, KademliaNode localNode, KademliaStorageEntry storageEntry, KademliaDHT localDht, KadConfiguration config)
|
||||
{
|
||||
this.server = server;
|
||||
this.localNode = localNode;
|
||||
|
Loading…
Reference in New Issue
Block a user