summaryrefslogtreecommitdiff
path: root/src/config_diff.mli
blob: 168b7487ed7d43c8999aaf6b6c6ed929d77a3152 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
type change = Unchanged | Added | Subtracted | Updated of string list

module Diff_tree : sig
    type t = { left: Config_tree.t;
               right: Config_tree.t;
               add: Config_tree.t;
               sub: Config_tree.t;
               del: Config_tree.t;
               inter: Config_tree.t;
             }
end

module Diff_compare : sig
    type t = { left: Config_tree.t;
               right: Config_tree.t;
               skel: Config_tree.t;
               ppath: string list;
               udiff: string;
             }
end

module Diff_show : sig
    type t = { left: Config_tree.t;
               right: Config_tree.t;
               base_path: string list;
               open_blocks: string list list;
               config_diff: string;
             }
end

type _ diff_result =
    | Diff_tree : Diff_tree.t -> Diff_tree.t diff_result
    | Diff_compare : Diff_compare.t -> Diff_compare.t diff_result
    | Diff_show : Diff_show.t -> Diff_show.t diff_result

val eval_diff_result : 'a diff_result -> 'a

type 'a diff_func = ?recurse:bool -> string list -> 'a diff_result -> change -> 'a diff_result
val diff : string list -> 'a diff_func -> 'a diff_result -> Config_tree.t option * Config_tree.t option -> 'a diff_result

exception Incommensurable
exception Empty_comparison
exception Nonexistent_child

val clone : ?recurse:bool -> ?set_values:string list option -> Config_tree.t -> Config_tree.t ->string list -> Config_tree.t
[@@alert exn "Vytree.Nonexistent_path"]

val diff_tree : string list -> Config_tree.t -> Config_tree.t -> Config_tree.t
[@@alert exn "Config_diff.Incommensurable"]
[@@alert exn "Config_diff.Empty_comparison"]

val diff_compare : ?cmds:bool -> string list -> Config_tree.t -> Config_tree.t -> string
[@@alert exn "Config_diff.Incommensurable"]
[@@alert exn "Config_diff.Empty_comparison"]

val diff_show : Reference_tree.t -> string list -> Config_tree.t -> Config_tree.t -> string
[@@alert exn "Config_diff.Incommensurable"]
[@@alert exn "Config_diff.Empty_comparison"]

val tree_union : Config_tree.t -> Config_tree.t -> Config_tree.t
[@@alert exn "Tree_alg.Incompatible_union"]
[@@alert exn "Tree_alg.Nonexistent_child"]

val tree_merge : ?destructive:bool -> Config_tree.t -> Config_tree.t -> Config_tree.t
[@@alert exn "Tree_alg.Incompatible_union"]
[@@alert exn "Tree_alg.Nonexistent_child"]

val mask_tree : ?exclusive:bool -> Config_tree.t -> Config_tree.t -> Config_tree.t
[@@alert exn "Config_diff.Incommensurable"]
[@@alert exn "Config_diff.Empty_comparison"]

val get_tagged_delete_tree : Config_tree.t -> Config_tree.t

exception Malformed_path of string
val subtree_from_partial : Reference_tree.t -> Config_tree.t -> Config_tree.t -> string list -> Config_tree.t
[@@alert exn "Config_diff.Malformed_path"]