added changes from future commits to last passing bmuller commit

This commit is contained in:
Alex Haynes
2019-04-17 20:21:59 -04:00
parent c5289952ee
commit d5c7cc7cb7
9 changed files with 115 additions and 12 deletions

View File

@ -12,6 +12,15 @@ log = logging.getLogger(__name__) # pylint: disable=invalid-name
class KademliaProtocol(RPCProtocol):
"""
There are four main RPCs in the Kademlia protocol
PING, STORE, FIND_NODE, FIND_VALUE
PING probes if a node is still online
STORE instructs a node to store (key, value)
FIND_NODE takes a 160-bit ID and gets back
(ip, udp_port, node_id) for k closest nodes to target
FIND_VALUE behaves like FIND_NODE unless a value is stored
"""
def __init__(self, source_node, storage, ksize):
RPCProtocol.__init__(self)
self.router = RoutingTable(self, ksize, source_node)
@ -28,6 +37,12 @@ class KademliaProtocol(RPCProtocol):
ids.append(rid)
return ids
def rpc_add_provider(self, sender, nodeid, key):
pass
def rpc_get_providers(self, sender, nodeid, key):
pass
def rpc_stun(self, sender): # pylint: disable=no-self-use
return sender