An implementation of a Kademlia, a distributed hash table (DHT).
Models JSON serializatin
Bases: bytestag.dht.models.Serializable
Represents a collection of file infos
Bases: bytestag.dht.models.Serializable
Represents the hashes of a file and its parts.
Bases: builtins.object
JSON keys
Bases: builtins.object
Bases: bytestag.dht.models.KVPExchangeInfo, bytestag.dht.models.JSONDumpable
Description about a key-value used for storage decisions.
Bases: builtins.list, bytestag.dht.models.JSONDumpable
A list of KVPExchangeInfo
Bases: builtins.list, bytestag.dht.models.JSONDumpable
A list of nodes
A node list is an array of objects.
Each object must contain the host name, port number, and base64 encoded node ID.
Return a node list
Raises: |
|
---|
Bases: unittest.case.TestCase
Bases: unittest.case.TestCase
Bases: unittest.case.TestCase
DHT networking protocols
Bases: bytestag.events.EventReactorMixin
The distributed hash table network
Cvariables : |
|
---|
The address of the server
Returns: | A tuple holding host and port number. |
---|---|
Return type: | tuple |
The FnTaskSlot which holds ReadStoreFromNodeTask.
Return nodes close to a key
Return type: | FindShortlistTask |
---|
Find the closest nodes to a key
Return type: | FindNodesFromNodeTask |
---|---|
Returns: | A future which returns a NodeList or None. |
Ask a node about values for a key
Parameters : | |
---|---|
Return type: | |
Returns: | A future which returns a FindValueFromNodeResult or None. |
Return nodes close to a key and may have the value
Return type: | FindShortlistTask |
---|
Download, from a node, data value associated to the key
Return type: | DownloadTask |
---|
Join the network
Return type: | JoinNetworkTask |
---|---|
Returns: | A future that returns bool. If True, the join was successful. |
Ping an address
Return type: | PingTask |
---|---|
Returns: | A future which returns bool or a tuple of (float, Node). If a tuple is returned, the ping was successful. The items represents the ping time and the node. |
The routing table
Return type: | RoutingTable |
---|
Send data to node.
Return type: | StoreToNodeTask |
---|
Publish or replicate value to nodes.
Return type: | StoreValueTask |
---|
Bases: bytestag.events.Task
Bases: bytestag.events.Task
Returns Shortlist
Bases: bytestag.dht.network.FindValueFromNodeResult
A named tuple representing key-value pair information or additional nodes.
Bases: bytestag.events.Task
Bases: bytestag.events.Task
Returns the bytes
Bases: bytestag.events.Task
Bases: bytestag.events.Task
Bases: builtins.object
A shortlist containing close nodes to a key
Add or remove the node from the shortlist.
Parameters : |
|
---|
Call this using the nodes from get_nodes_for_contacting.
Bases: bytestag.events.Task
Returns the number of bytes sent
Bases: bytestag.events.Task
Stores a value to many nodes
Observer for when StoreToNodeTask is started and finished.
The first argument of the callback is bool. If True, the task was created. Otherwise, the task was finished. The second argument is StoreToNodeTask
DHT publisher
This module includes classes that scan tables for values to publish or replicate.
Bases: bytestag.events.EventReactorMixin
Publishes values typically created by the client.
Bases: bytestag.events.EventReactorMixin
Replicates values typically stored into the cache by other nodes.
Node tables
Bases: builtins.object
A bucket of nodes.
This class supports container methods with Node.
Bases: builtins.Exception
Bucket is full
Ivariables : |
|
---|
Bases: builtins.object
An end-point connection.
This class implements equality and comparison operators using the key and address of the node.
Bases: builtins.object
A list of buckets