mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 04:21:51 +00:00
python: update cython wrapper and python benchmark
API changed when the keys pec was added. This commit updates python code according to the new API.
This commit is contained in:
1 parent
bb3069170c
commit
593b9010a7
3 files changed
+16
-10
No files matched your search
@@ -10,6 +10,7 @@ import string
|
||||
import time
|
||||
import subprocess
|
||||
import re
|
||||
import collections
|
||||
|
||||
from matplotlib.ticker import FuncFormatter
|
||||
import math
|
||||
@@ -276,17 +277,18 @@ class PhtTest(FeatureTest):
|
||||
"""
|
||||
bootstrap = self._bootstrap
|
||||
bootstrap.resize(2)
|
||||
|
||||
dht = bootstrap.get(1)
|
||||
pht = Pht(b'foo_index', dht)
|
||||
|
||||
NUM_DIG = max(math.log(self._num_keys, 2)/4, 5) # at least 5 digit keys.
|
||||
keyspec = collections.OrderedDict([('foo', NUM_DIG)])
|
||||
pht = Pht(b'foo_index', keyspec, dht)
|
||||
|
||||
DhtNetwork.log('PHT has',
|
||||
pht.MAX_NODE_ENTRY_COUNT,
|
||||
'node'+ ('s' if pht.MAX_NODE_ENTRY_COUNT > 1 else ''),
|
||||
'per leaf bucket.')
|
||||
NUM_DIG = max(math.log(self._num_keys, 2)/4, 5) # at least 5 digit keys.
|
||||
keys = [{
|
||||
'foo' :
|
||||
[_ for _ in keyspec.keys()][0] :
|
||||
''.join(random.SystemRandom().choice(string.hexdigits)
|
||||
for _ in range(NUM_DIG)).encode()
|
||||
} for n in range(self._num_keys)]
|
||||
|
||||
Reference in new issue
Block a user