Skip to content

Commit

Permalink
irmin: Bring iter back
Browse files Browse the repository at this point in the history
  • Loading branch information
clecat authored and art-w committed Apr 11, 2024
1 parent 4e42315 commit 9c7be8d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/irmin-pack/io/lru.ml
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,5 @@ let mem { lru; _ } k = Internal.mem lru k
let clear t =
Internal.clear t.lru;
t.total_weight <- 0

let iter { lru; _ } f = Internal.iter lru (fun k wv -> f k (v wv))
1 change: 1 addition & 0 deletions src/irmin-pack/io/lru.mli
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ val add : t -> int63 -> Irmin_pack.Pack_value.weight -> value -> unit
val find : t -> key -> value
val mem : t -> key -> bool
val clear : t -> unit
val iter : t -> (key -> value -> unit) -> unit
2 changes: 2 additions & 0 deletions src/irmin/lru.ml
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,6 @@ module Make (H : Hashtbl.HashedType) = struct
in
Xt.commit { tx }

let iter t f =
HT.iter (fun k q -> f k (snd q.Q.value)) t.ht
end
1 change: 1 addition & 0 deletions src/irmin/lru.mli
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ module Make (H : Hashtbl.HashedType) : sig
val find : 'a t -> H.t -> 'a
val mem : 'a t -> H.t -> bool
val clear : 'a t -> unit
val iter : 'a t -> (H.t -> 'a -> unit) -> unit
val drop : 'a t -> 'a option
end

0 comments on commit 9c7be8d

Please sign in to comment.