Skip to main content
This is a basic implementation of a dht using gevent.

There are two things you have to concern yourself with.
1.) Bootstrapping the network.
The following example creates a network of one node

-------------------------------------------------------------------
import gevent_dht
table = gevent_dht.distributedHashTable(None) #This tell the network it
# is the first node by default it listens on port 8339
#

table['key_1'] = [1,2,3] #This sets a value in our hash table
for i in table['key_1']:
print i #Prints 123

table.append('key_1', 4) #Adds an item to a list in a hash table
#Note if the key is not in the hash table
#It will put a list in place and then append
#to it.

#Now we are adding another node

other_clients_table = gevent_dht.distributedHashTable(
'127.0.0.1:8339', local_port = 8449)
#Another client has connected. It supplied the address of
# a node in the network to connect with the preexisting network

for i in other_clients_table['key_1']:
print i #Prints 1234

-------------------------------------------------------------------

So in order to connect to an existing network you must have a way to get an
address of another member. It doesn't have to be the first node but needs
to be a node in the network.

2.) Latency/ This may fail.

Keys are not guarenteed to persist forever, nodes may crash, the network
may eat messages etc... While we are working in tcp/ip mode there may still
be bizarre glitches. Always check for a return value of None.

Additionally due to the time it takes for messages to travel the network
sometimes a key will not be immedietly available after you set it or
when you get the result back it may not be completely current.

Release files for gevent_dht 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gevent_dht 0.1.3
File Size Uploaded
gevent_dht-0.1.3.tar.gz 6.6 kB Details

Release files / gevent_dht-0.1.3.tar.gz

Download URL gevent_dht-0.1.3.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
94713e78d00d365fce0e6c28f0ea11f6cd2f233f7f7bf5f30b794faf41a0ea18
BLAKE2b-256 checksum
How to use checksums
8fc404b7746b77f46096a93419d538b5a5f9dcace41970a46a88436b77e162e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.3 This release

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page