3 let main ~stream ~interval ~dir =
4 let dumped = Time.init in
5 ignore (Msg_stream.fold stream ~init:dumped ~f:(
6 fun dumped ~state:(State.({node; modul; time = now; cache;})) ~msg:_ ->
7 let elapsed = Time.diff dumped now in
8 if (Time.Span.is_gt_or_eq elapsed interval)
10 Cache.dump_to_dir cache ~time:now ~node ~modul ~dir;
17 let modul = __MODULE__ in
18 let node = Sys.argv.(1) in
19 let dump_interval = Sys.argv.(2) |> Time.Span.of_string in
20 let dump_directory = Sys.argv.(3) in
22 ~stream: (Msg_stream.init ~node ~modul)
23 ~interval: dump_interval