|
1 | 1 | package io.ep2p.kademlia.netty.standalone;
|
2 | 2 |
|
3 | 3 | import io.ep2p.kademlia.NodeSettings;
|
4 |
| -import io.ep2p.kademlia.exception.DuplicateStoreRequest; |
5 | 4 | import io.ep2p.kademlia.model.LookupAnswer;
|
6 | 5 | import io.ep2p.kademlia.model.StoreAnswer;
|
7 | 6 | import io.ep2p.kademlia.netty.NettyKademliaDHTNode;
|
@@ -39,7 +38,8 @@ public String serve(
|
39 | 38 | new BigInteger(id),
|
40 | 39 | new NettyConnectionInfo(host, port),
|
41 | 40 | new SampleRepository(),
|
42 |
| - new ShellKeyHashGenerator() |
| 41 | + new ShellKeyHashGenerator(), |
| 42 | + String.class, String.class |
43 | 43 | ).build();
|
44 | 44 |
|
45 | 45 | if (!bootstrapNodeAddress.equals("none")){
|
@@ -67,14 +67,14 @@ public String serve(
|
67 | 67 | }
|
68 | 68 |
|
69 | 69 | @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()); |
73 | 73 | }
|
74 | 74 |
|
75 | 75 | @ShellMethod(value = "Looks up data from DHT")
|
76 | 76 | 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(); |
78 | 78 | return String.format("Lookup result: %s - Value: %s%n", lookupAnswer.getResult(), lookupAnswer.getValue());
|
79 | 79 | }
|
80 | 80 |
|
|
0 commit comments