mirage / irmin

Irmin is a distributed database that follows the same design principles as Git
https://irmin.org
ISC License
1.86k stars 157 forks source link

`Object_graph.iter` needs cleaning #1359

Open Ngoguey42 opened 3 years ago

Ngoguey42 commented 3 years ago

Aside from needing more docstrings, more tests (#1134) and maybe some benchmarks, the specifications of Object_graph.iter need to be improved.

Issues:

Summaty of the 4 APIs of iter
Object_graph.S.iter
    cache_size ->
    depth ->
    pred ->
    node -> edge ->
    skip ->
    t -> min -> max -> rev -> unit -> unit Lwt.t

Node.Graph.iter
    node -> contents -> edge ->
    skip_node -> skip_contents ->
    t -> min -> max -> ?(rev = true) -> unit -> unit Lwt.t

Repo.iter
    cache_size ->
    edge branch commit node contents
    skip_branch -> skip_commit -> skip_node -> skip_contents ->
    pred_branch -> pred_commit -> pred_node -> pred_contents ->
    t -> min -> max -> ?(rev = true) -> unit Lwt.t

Commit.History.iter
    commit -> edge ->
    skip ->
    t -> min -> max -> ?(rev = false) -> unit -> unit Lwt.t
samoht commented 2 years ago

This needs a new scheduling label.

Ngoguey42 commented 2 years ago

As discussed offline with @n-osborne a few months ago, iter would be more predictable if min was made simpler.

min should be the list of objects that iter will stop at (i.e. no special case).

A new boolean flag should control whether the mins are included or excluded from the iteration (i.e. whether or not they are passed to edge and node)