package irmin
Mutable sets of strings with a common length.
val create :
elt_length:int ->
?initial_slots:int ->
?hash:(elt -> int) ->
?hash_substring:(Bigstringaf.t -> off:int -> len:int -> int) ->
?null:string ->
unit ->
t
create
builds an empty set of fixed-length strings. The parameters are as follows:
elt_length
: the length of each element string in bytes;
initial_slots
: the minimum number of slots contained in the initial internal buffer (NOTE: the actual number of slots will be the least power of two greater than or equal toinitial_buffer
. This is not the same as the number of elements that can fit inside the buffer, which also depends on the maximum load factor);
hash
/hash_substring
: functions to use for placing elements inside the internal buffer (given that the element is contained in a string or a bigstring respectively). The stored elements must have uniformly distributedhash
results for good performance, and the two hash functions must be equivalent. Defaults toHashtbl.hash
(and an equivalent function on substrings).
add t elt
adds elt
to the set t
and returns `Ok
if elt
is not already a member of t
, otherwise returns `Duplicate
and leaves the hashset unchanged.
invariant f t
checks the internal invariants of t
and calls f
on every element contained within. Exposed for testing.
val reachable_words : t -> int
reachable_words t
is the total number of words of data kept alive by t
(on both the C and OCaml heaps).
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>