Skip to content

Commit

Permalink
Merkle_ledger: mv Graphviz_intf to Intf
Browse files Browse the repository at this point in the history
  • Loading branch information
rbonichon committed Feb 16, 2024
1 parent e2b3dc5 commit 1a6423d
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 50 deletions.
1 change: 0 additions & 1 deletion src/lib/merkle_ledger/dune
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
(:standard -w +a-40..42-44 -warn-error +a-70 -open Core))
(library_flags -linkall)
(modules_without_implementation
graphviz_intf
location_intf)
(libraries
;; opam libraries
Expand Down
4 changes: 2 additions & 2 deletions src/lib/merkle_ledger/graphviz.ml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
open Core
open Async

module Make (Inputs : Graphviz_intf.Inputs_intf) :
Graphviz_intf.S
module Make (Inputs : Intf.Graphviz.I) :
Intf.Graphviz.S
with type addr := Inputs.Location.Addr.t
and type ledger := Inputs.Ledger.t = struct
open Inputs
Expand Down
4 changes: 2 additions & 2 deletions src/lib/merkle_ledger/graphviz.mli
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(** Visualizable_ledger shows a subgraph of a merkle_ledger using Graphviz *)

module Make (Inputs : Graphviz_intf.Inputs_intf) :
Graphviz_intf.S
module Make (Inputs : Intf.Graphviz.I) :
Intf.Graphviz.S
with type addr := Inputs.Location.Addr.t
and type ledger := Inputs.Ledger.t
45 changes: 0 additions & 45 deletions src/lib/merkle_ledger/graphviz_intf.mli

This file was deleted.

32 changes: 32 additions & 0 deletions src/lib/merkle_ledger/intf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -440,3 +440,35 @@ module Ledger = struct
end
end
end

module Graphviz = struct
module type S = sig
type addr

type ledger

type t

(* Visualize will enumerate through all edges of a subtree with a
initial_address. It will then interpret all of the edges and nodes into an
intermediate form that will be easy to write into a dot file *)
val visualize : ledger -> initial_address:addr -> t

(* Write will transform the intermediate form generate by visualize and save
the results into a dot file *)
val write : path:string -> name:string -> t -> unit Async.Deferred.t
end

module type I = sig
include Inputs.Intf

module Ledger :
Ledger.S
with module Addr = Location.Addr
and module Location = Location
and type account_id := Account_id.t
and type account_id_set := Account_id.Set.t
and type hash := Hash.t
and type account := Account.t
end
end

0 comments on commit 1a6423d

Please sign in to comment.