package async_smtp

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file gc_admin.ml

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
open! Core
open Async
open Async_smtp
open Common

let gc_command summary rpc =
  let open Command.Let_syntax in
  Command.rpc
    ~summary
    [%map_open
      let () = return () in
      fun client ->
        let open Deferred.Let_syntax in
        let%map () = Rpc.Rpc.dispatch_exn rpc client () in
        printf "OK\n"]
;;

let gc_stat_command summary rpc =
  let open Command.Let_syntax in
  Command.rpc
    ~summary
    [%map_open
      let () = return () in
      fun client ->
        let open Deferred.Let_syntax in
        let%map stat = Rpc.Rpc.dispatch_exn rpc client () in
        printf !"%{sexp:Gc.Stat.t}\n" stat]
;;

let stat = gc_stat_command "Gc.stat" Smtp_rpc_intf.Gc.stat
let quick_stat = gc_stat_command "Gc.quick_stat" Smtp_rpc_intf.Gc.quick_stat
let full_major = gc_command "Gc.full_major" Smtp_rpc_intf.Gc.full_major
let major = gc_command "Gc.major" Smtp_rpc_intf.Gc.major
let minor = gc_command "Gc.minor" Smtp_rpc_intf.Gc.minor
let compact = gc_command "Gc.compact" Smtp_rpc_intf.Gc.compact

let command =
  Command.group
    ~summary:"GC management"
    [ "stat", stat
    ; "quick-stat", quick_stat
    ; "full-major", full_major
    ; "major", major
    ; "minor", minor
    ; "compact", compact
    ]
;;
OCaml

Innovation. Community. Security.