Class: KademliaRules

KademliaRules

Represent kademlia protocol handlers

new KademliaRules(node)

Constructs a kademlia rules instance in the context of a KademliaNode
Parameters:
Name Type Description
node KademliaNode
Source:

Methods


findNode(request, response, next)

The FIND_NODE RPC includes a 160-bit key. The recipient of the RPC returns up to K contacts that it knows to be closest to the key. The recipient must return K contacts if at all possible. It may only return fewer than K if it is returning all of the contacts that it has knowledge of.
Parameters:
Name Type Description
request AbstractNode~request
response AbstractNode~response
next AbstractNode~next
Source:

findValue(request, response, next)

A FIND_VALUE RPC includes a B=160-bit key. If a corresponding value is present on the recipient, the associated data is returned. Otherwise the RPC is equivalent to a FIND_NODE and a set of K contacts is returned.
Parameters:
Name Type Description
request AbstractNode~request
response AbstractNode~response
next AbstractNode~next
Source:

ping(request, response)

This RPC involves one node sending a PING message to another, which presumably replies with a PONG. This has a two-fold effect: the recipient of the PING must update the bucket corresponding to the sender; and, if there is a reply, the sender must update the bucket appropriate to the recipient.
Parameters:
Name Type Description
request AbstractNode~request
response AbstractNode~response
Source:

store(request, response, next)

The sender of the STORE RPC provides a key and a block of data and requires that the recipient store the data and make it available for later retrieval by that key.
Parameters:
Name Type Description
request AbstractNode~request
response AbstractNode~response
next AbstractNode~next
Source: