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