@@ -63,6 +63,21 @@ module Prefix = struct
63
63
|> List. filter_map ~f: match_rule
64
64
|> List. max_elt ~compare
65
65
|> Option. map ~f: (fun (res : prefix_rule * int ) -> (fst res).channel_name)
66
+
67
+ let print_prefix_routing rules =
68
+ let show_match l = String. concat ~sep: " or " @@ List. map ~f: (fun s -> s ^ " *" ) l in
69
+ rules
70
+ |> List. iter ~f: (fun (rule : prefix_rule ) ->
71
+ begin
72
+ match rule.allow, rule.ignore with
73
+ | None , None -> Stdio. printf " any"
74
+ | None , Some [] -> Stdio. printf " any"
75
+ | None , Some l -> Stdio. printf " not %s" (show_match l)
76
+ | Some l , None -> Stdio. printf " %s" (show_match l)
77
+ | Some l , Some [] -> Stdio. printf " %s" (show_match l)
78
+ | Some l , Some i -> Stdio. printf " %s and not %s" (show_match l) (show_match i)
79
+ end ;
80
+ Stdio. printf " -> #%s\n %!" rule.channel_name)
66
81
end
67
82
68
83
module Label = struct
@@ -83,4 +98,19 @@ module Label = struct
83
98
| Some allow_list -> if List. exists allow_list ~f: label_name_equal then Some rule.channel_name else None
84
99
in
85
100
rules |> List. filter_map ~f: match_rule |> List. dedup_and_sort ~compare: String. compare
101
+
102
+ let print_label_routing rules =
103
+ let show_match l = String. concat ~sep: " or " l in
104
+ rules
105
+ |> List. iter ~f: (fun (rule : label_rule ) ->
106
+ begin
107
+ match rule.allow, rule.ignore with
108
+ | None , None -> Stdio. printf " any"
109
+ | None , Some [] -> Stdio. printf " any"
110
+ | None , Some l -> Stdio. printf " not %s" (show_match l)
111
+ | Some l , None -> Stdio. printf " %s" (show_match l)
112
+ | Some l , Some [] -> Stdio. printf " %s" (show_match l)
113
+ | Some l , Some i -> Stdio. printf " %s and not %s" (show_match l) (show_match i)
114
+ end ;
115
+ Stdio. printf " -> #%s\n %!" rule.channel_name)
86
116
end
0 commit comments