Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

irmin: add Repo.iter #1128

Merged
merged 1 commit into from
Nov 14, 2020
Merged

irmin: add Repo.iter #1128

merged 1 commit into from
Nov 14, 2020

Conversation

samoht
Copy link
Member

@samoht samoht commented Nov 12, 2020

It allows to iterate efficiently over the object graph.

Extracted from #1124

Copy link
Member

@craigfe craigfe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Would be good to have tests of the newly-introduced edge cases re. branches and cuts, but that can probably wait for another day.

?edge:(node -> node -> unit Lwt.t) ->
?skip_nodes:(node -> bool Lwt.t) ->
?skip_contents:(contents * metadata -> bool Lwt.t) ->
?skip_node:(node -> bool Lwt.t) ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub won't let me suggest it, but need to s/skip_nodes/skip_node/ in comment below.

src/irmin/dot.ml Outdated
let vertex = Hashtbl.fold (fun k v acc -> (map k, v) :: acc) vertex [] in
let edges = List.map (fun (k, l, v) -> (map k, l, map v)) !edges in
let vertex = Hashtbl.fold (fun k v acc -> (k, v) :: acc) vertex [] in
let edges = List.map (fun (k, l, v) -> (k, l, v)) !edges in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we can remove this map altogether?

It allows to iterate efficiently over the object graph.
@samoht samoht merged commit dfef248 into mirage:master Nov 14, 2020
@samoht samoht deleted the better-iter branch November 14, 2020 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants