public class Kademlia extends Object
| Modifier and Type | Field and Description |
|---|---|
protected KademliaClient |
client |
protected Configuration |
config |
protected Node |
localNode |
protected LocalStorage |
localStorage |
protected RoutingTable |
routingTable |
protected List<KademliaServer> |
servers |
| Constructor and Description |
|---|
Kademlia(Configuration config) |
Kademlia(Configuration config,
LocalStorage localStorage) |
Kademlia(Key nodeId) |
Kademlia(Key nodeId,
String listeners) |
Kademlia(Key nodeId,
String listeners,
LocalStorage localStorage) |
| Modifier and Type | Method and Description |
|---|---|
void |
addEventListener(String registrationId,
java.util.function.Consumer<Event> eventConsumer) |
void |
bootstrap(Node bootstrapNode) |
void |
close() |
String |
get(Key key)
Retrieve the Value associated with the Key
|
void |
get(Key key,
java.util.function.Consumer<ValueReply> valueReplyConsumer) |
Node |
getLocalNode() |
RoutingTable |
getRoutingTable() |
void |
put(Key key,
String value)
Put or Update the value in the DHT
|
void |
refreshBuckets() |
void |
removeEventListener(String registrationId) |
void |
republishKeys()
Execute key republishing
Iterate over all keys that weren't updated within the last hour and republish
to the other k-nodes that are closest to the associated keys
|
protected final RoutingTable routingTable
protected final KademliaClient client
protected final List<KademliaServer> servers
protected final LocalStorage localStorage
protected final Node localNode
protected final Configuration config
public Kademlia(Key nodeId)
public Kademlia(Key nodeId, String listeners, LocalStorage localStorage)
public Kademlia(Configuration config)
public Kademlia(Configuration config, LocalStorage localStorage)
public void bootstrap(Node bootstrapNode)
public void put(Key key, String value)
key - value - public String get(Key key)
key - public void get(Key key, java.util.function.Consumer<ValueReply> valueReplyConsumer)
public void republishKeys()
public void refreshBuckets()
public RoutingTable getRoutingTable()
public Node getLocalNode()
public void close()
public void addEventListener(String registrationId, java.util.function.Consumer<Event> eventConsumer)
public void removeEventListener(String registrationId)
Copyright © 2016. All Rights Reserved.