package dune-rpc
Communicate with dune using rpc
Install
Dune Dependency
Authors
Maintainers
Sources
dune-3.16.1.tbz
sha256=b781ae20f87613c2a11bd0717809e00470c82d615e15264f9a64e033051ac3de
sha512=fddf940d5634400fa14f6728235e0dba055b90a47f868d9fee80c9523b93fb2b9920a00e70dfdc5e1dd26a21d695ce854267b6a2ec305ce89ce9447733f7242c
doc/src/dune-rpc.private/procedures.ml.html
Source file procedures.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 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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
open Import open Types open Exported_types module Public = struct module Ping = struct let v1 = Decl.Request.make_current_gen ~req:Conv.unit ~resp:Conv.unit ~version:1 let decl = Decl.Request.make ~method_:"ping" ~generations:[ v1 ] end module Diagnostics = struct let v1 = Decl.Request.make_gen ~version:1 ~req:Conv.unit ~resp:(Conv.list Diagnostics_v1.sexp) ~upgrade_req:Fun.id ~downgrade_req:Fun.id ~upgrade_resp:(List.map ~f:Diagnostics_v1.to_diagnostic) ~downgrade_resp:(List.map ~f:Diagnostics_v1.of_diagnostic) ;; let v2 = Decl.Request.make_current_gen ~version:2 ~req:Conv.unit ~resp:(Conv.list Diagnostic.sexp) ;; let decl = Decl.Request.make ~method_:"diagnostics" ~generations:[ v1; v2 ] end module Shutdown = struct let v1 = Decl.Notification.make_current_gen ~conv:Conv.unit ~version:1 let decl = Decl.Notification.make ~method_:"shutdown" ~generations:[ v1 ] end module Format_dune_file = struct module V1 = struct let req = let open Conv in let path = field "path" (required string) in let contents = field "contents" (required string) in let to_ (path, contents) = path, `Contents contents in let from (path, `Contents contents) = path, contents in iso (record (both path contents)) to_ from ;; end let v1 = Decl.Request.make_current_gen ~req:V1.req ~resp:Conv.string ~version:1 let decl = Decl.Request.make ~method_:"format-dune-file" ~generations:[ v1 ] end module Promote = struct let v1 = Decl.Request.make_current_gen ~req:Path.sexp ~resp:Conv.unit ~version:1 let decl = Decl.Request.make ~method_:"promote" ~generations:[ v1 ] end module Build_dir = struct let v1 = Decl.Request.make_current_gen ~req:Conv.unit ~resp:Path.sexp ~version:1 let decl = Decl.Request.make ~method_:"build_dir" ~generations:[ v1 ] end let ping = Ping.decl let diagnostics = Diagnostics.decl let shutdown = Shutdown.decl let format_dune_file = Format_dune_file.decl let promote = Promote.decl let build_dir = Build_dir.decl end module Server_side = struct module Abort = struct let v1 = Decl.Notification.make_current_gen ~conv:Message.sexp ~version:1 let decl = Decl.Notification.make ~method_:"notify/abort" ~generations:[ v1 ] end module Log = struct let v1 = Decl.Notification.make_current_gen ~conv:Message.sexp ~version:1 let decl = Decl.Notification.make ~method_:"notify/log" ~generations:[ v1 ] end let abort = Abort.decl let log = Log.decl end module Poll = struct let cancel_gen = Decl.Notification.make_current_gen ~conv:Id.sexp ~version:1 module Name = struct include String let make s = s end type 'a t = { poll : (Id.t, 'a option) Decl.request ; cancel : Id.t Decl.notification ; name : Name.t } let make name generations = let poll = Decl.Request.make ~method_:("poll/" ^ name) ~generations in let cancel = Decl.Notification.make ~method_:("cancel-poll/" ^ name) ~generations:[ cancel_gen ] in { poll; cancel; name } ;; let poll t = t.poll let cancel t = t.cancel let name t = t.name module Progress = struct module V1 = struct type t = | Waiting | In_progress of { complete : int ; remaining : int } | Failed | Interrupted | Success let sexp = let open Conv in let waiting = constr "waiting" unit (fun () -> Waiting) in let failed = constr "failed" unit (fun () -> Failed) in let in_progress = let complete = field "complete" (required int) in let remaining = field "remaining" (required int) in constr "in_progress" (record (both complete remaining)) (fun (complete, remaining) -> In_progress { complete; remaining }) in let interrupted = constr "interrupted" unit (fun () -> Interrupted) in let success = constr "success" unit (fun () -> Success) in let constrs = List.map ~f:econstr [ waiting; failed; interrupted; success ] @ [ econstr in_progress ] in let serialize = function | Waiting -> case () waiting | In_progress { complete; remaining } -> case (complete, remaining) in_progress | Failed -> case () failed | Interrupted -> case () interrupted | Success -> case () success in sum constrs serialize ;; let to_progress : t -> Progress.t = function | Waiting -> Waiting | In_progress { complete; remaining } -> In_progress { complete; remaining; failed = 0 } | Failed -> Failed | Interrupted -> Interrupted | Success -> Success ;; let of_progress : Progress.t -> t = function | Waiting -> Waiting | In_progress { complete; remaining; failed = _ } -> In_progress { complete; remaining } | Failed -> Failed | Interrupted -> Interrupted | Success -> Success ;; end let name = "progress" let v1 = Decl.Request.make_gen ~version:1 ~req:Id.sexp ~resp:(Conv.option V1.sexp) ~upgrade_req:Fun.id ~downgrade_req:Fun.id ~upgrade_resp:(Option.map ~f:V1.to_progress) ~downgrade_resp:(Option.map ~f:V1.of_progress) ;; let v2 = Decl.Request.make_current_gen ~version:2 ~req:Id.sexp ~resp:(Conv.option Progress.sexp) ;; end module Diagnostic = struct let name = "diagnostic" let v1 = Decl.Request.make_gen ~version:1 ~req:Id.sexp ~resp:(Conv.option (Conv.list Diagnostics_v1.Event.sexp)) ~upgrade_req:Fun.id ~downgrade_req:Fun.id ~upgrade_resp:(Option.map ~f:(List.map ~f:Diagnostics_v1.Event.to_event)) ~downgrade_resp:(Option.map ~f:(List.map ~f:Diagnostics_v1.Event.of_event)) ;; let v2 = Decl.Request.make_current_gen ~version:2 ~req:Id.sexp ~resp:(Conv.option (Conv.list Diagnostic.Event.sexp)) ;; end module Job = struct let name = "running-jobs" let v1 = Decl.Request.make_current_gen ~req:Id.sexp ~resp:(Conv.option (Conv.list Job.Event.sexp)) ~version:1 ;; end let progress = let open Progress in make name [ v1; v2 ] ;; let diagnostic = let open Diagnostic in make name [ v1; v2 ] ;; let running_jobs = let open Job in make name [ v1 ] ;; end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>