package octez-internal-libs

  1. Overview
  2. Docs
A package that contains some libraries used by the Octez suite

Install

Dune Dependency

Authors

Maintainers

Sources

tezos-octez-v20.1.tag.bz2
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65

doc/irmin_data/Irmin_data/Fixed_size_string_set/index.html

Module Irmin_data.Fixed_size_string_setSource

Mutable sets of strings with a common length.

Sourcetype t

The type of mutable sets of fixed-length strings.

type elt := string
Sourceval 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 to initial_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 distributed hash results for good performance, and the two hash functions must be equivalent. Defaults to Hashtbl.hash (and an equivalent function on substrings).
  • null: a string of size elt_length that is guaranteed to never be added to the hashset. Passing this string to add or mem after creating the hashset will result in an exception being raised.
Sourceval add : t -> elt -> [ `Ok | `Duplicate ]

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.

Sourceval add_exn : t -> elt -> unit

add_exn t elt adds elt to the set t.

  • raises Invalid_argument

    if elt is already a member of t.

Sourceval mem : t -> elt -> bool

mem t elt is true iff elt has been added to the hashset.

Sourceval invariant : (elt -> unit) -> t -> unit

invariant f t checks the internal invariants of t and calls f on every element contained within. Exposed for testing.

Sourceval 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).

OCaml

Innovation. Community. Security.