Skip to content

Commit fe698c6

Browse files
author
sepgh
committed
feat: using kademlia-netty 0.3.0
1 parent 1496448 commit fe698c6

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</parent>
1111
<groupId>io.ep2p</groupId>
1212
<artifactId>kademlia-netty-standalone-test</artifactId>
13-
<version>0.0.1-SNAPSHOT</version>
13+
<version>0.0.2-SNAPSHOT</version>
1414
<name>kademlia-netty-standalone-test</name>
1515
<description>Demo project for Spring Boot</description>
1616
<properties>
@@ -21,7 +21,7 @@
2121
<dependency>
2222
<groupId>io.ep2p</groupId>
2323
<artifactId>kademlia-netty</artifactId>
24-
<version>0.1.7-RELEASE</version>
24+
<version>0.3.0-RELEASE</version>
2525
</dependency>
2626

2727
<dependency>

src/main/java/io/ep2p/kademlia/netty/standalone/ShellCommands.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package io.ep2p.kademlia.netty.standalone;
22

33
import io.ep2p.kademlia.NodeSettings;
4-
import io.ep2p.kademlia.exception.DuplicateStoreRequest;
54
import io.ep2p.kademlia.model.LookupAnswer;
65
import io.ep2p.kademlia.model.StoreAnswer;
76
import io.ep2p.kademlia.netty.NettyKademliaDHTNode;
@@ -39,7 +38,8 @@ public String serve(
3938
new BigInteger(id),
4039
new NettyConnectionInfo(host, port),
4140
new SampleRepository(),
42-
new ShellKeyHashGenerator()
41+
new ShellKeyHashGenerator(),
42+
String.class, String.class
4343
).build();
4444

4545
if (!bootstrapNodeAddress.equals("none")){
@@ -67,14 +67,14 @@ public String serve(
6767
}
6868

6969
@ShellMethod(value = "Stores data into DHT")
70-
public String store(String key, String value) throws DuplicateStoreRequest, ExecutionException, InterruptedException {
71-
StoreAnswer<BigInteger, String> storeAnswer = this.applicationContext.getNode().store(key, value).get();
72-
return String.format("Store result: %s - Node: %s%n", storeAnswer.getResult(), storeAnswer.getNodeId());
70+
public String store(String key, String value) throws ExecutionException, InterruptedException {
71+
StoreAnswer<BigInteger, NettyConnectionInfo, String> storeAnswer = this.applicationContext.getNode().store(key, value).get();
72+
return String.format("Store result: %s - Node: %s%n", storeAnswer.getResult(), storeAnswer.getNode().getId());
7373
}
7474

7575
@ShellMethod(value = "Looks up data from DHT")
7676
public String lookup(String key) throws ExecutionException, InterruptedException {
77-
LookupAnswer<BigInteger, String, String> lookupAnswer = this.applicationContext.getNode().lookup(key).get();
77+
LookupAnswer<BigInteger, NettyConnectionInfo, String, String> lookupAnswer = this.applicationContext.getNode().lookup(key).get();
7878
return String.format("Lookup result: %s - Value: %s%n", lookupAnswer.getResult(), lookupAnswer.getValue());
7979
}
8080

0 commit comments

Comments
 (0)