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:
Simon Désaulniers authored and Adrien Béraud committed 2016-09-01 18:02:23 -04:00
1 parent f8cf1316ad
commit 6da8d39a0e
3 files changed
+16 -11

No files matched your search

+6 -5
View File
@@ -11,7 +11,7 @@ import string
import time
import subprocess
import re
import traceback
import collections
from matplotlib.ticker import FuncFormatter
import math
@@ -307,17 +307,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)]