mirror of https://github.com/borgbackup/borg.git
hashindex: export max load factor to Python-space
This commit is contained in:
parent
b1d3a39a63
commit
9fe0140d94
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue