hashindex: export max load factor to Python-space

This commit is contained in:
Marian Beermann 2016-09-07 16:08:07 +02:00
parent b1d3a39a63
commit 9fe0140d94
2 changed files with 8 additions and 0 deletions

View File

@ -23,6 +23,8 @@ cdef extern from "_hashindex.c":
uint32_t _htole32(uint32_t v)
uint32_t _le32toh(uint32_t v)
double HASH_MAX_LOAD
cdef _NoDefault = object()
@ -54,6 +56,7 @@ cdef class IndexBase:
cdef HashIndex *index
cdef int key_size
MAX_LOAD_FACTOR = HASH_MAX_LOAD
def __cinit__(self, capacity=0, path=None, key_size=32):
self.key_size = key_size
if path:

View File

@ -276,3 +276,8 @@ def test_nsindex_segment_limit():
assert H(1) not in idx
idx[H(2)] = hashindex.MAX_VALUE, 0
assert H(2) in idx
def test_max_load_factor():
assert NSIndex.MAX_LOAD_FACTOR < 1
assert ChunkIndex.MAX_LOAD_FACTOR < 1