Module Hashtbl.Xt

Explicit transaction log passing on hash tables.

val length : xt:'x Kcas.Xt.t -> ('k, 'v) t -> int

length t returns the number of bindings in the hash table t.

⚠️ The returned value may be greater than the number of distinct keys in the hash table.

val reset : xt:'x Kcas.Xt.t -> ('k, 'v) t -> unit

reset t remove all bindings from the hash table t and shrinks the capacity of the table back to the minimum.

val clear : xt:'x Kcas.Xt.t -> ('k, 'v) t -> unit

clear is a synonym for reset.

val remove : xt:'x Kcas.Xt.t -> ('k, 'v) t -> 'k -> unit

remove t k removes the most recent existing binding of key k, if any, from the hash table t thereby revealing the earlier binding of k, if any.

val add : xt:'x Kcas.Xt.t -> ('k, 'v) t -> 'k -> 'v -> unit

add t k v adds a binding of key k to value v to the hash table shadowing the previous binding of the key k, if any.

⚠️ Consider using replace instead of add.

val replace : xt:'x Kcas.Xt.t -> ('k, 'v) t -> 'k -> 'v -> unit

replace t k v adds a binding of key k to value v or replaces the most recent existing binding of key k in the hash table t.

val mem : xt:'x Kcas.Xt.t -> ('k, 'v) t -> 'k -> bool

mem t k is equivalent to Option.is_some (find_opt t k).

val find_opt : xt:'x Kcas.Xt.t -> ('k, 'v) t -> 'k -> 'v option

find_opt t k returns the current binding of key k in the hash table t, or None if no such binding exists.

val find_all : xt:'x Kcas.Xt.t -> ('k, 'v) t -> 'k -> 'v list

find_all t k returns a list of all the bindings of the key k in the hash table in reverse order of their introduction.