package corosync
OCaml Corosync binding
Install
Dune Dependency
Authors
Maintainers
Sources
corosync-0.1.0.tbz
sha256=50dfd86c7142e6fcd1a9aac3f17733e4ce4036823d3447852afa753152a88821
sha512=d43d33f1073bea24dfe3443859673dceeb7c26bae8198d7fef0477dc9779e51ffb5771e1a2964c0ae9ff73625c48e3e74d6d221dbcc3c803e8481331e443c7a3
doc/src/corosync.lib/quorum.ml.html
Source file quorum.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
open Ctypes open Foreign open Corotypes open CsError let ( >>= ) = Result.bind let quorum_handle_t = uint64_t let quorum_notification_fn_t = quorum_handle_t @-> uint32_t @-> uint64_t @-> uint32_t @-> ptr uint32_t @-> returning void type quorum_callbacks_t let quorum_callbacks_t : quorum_callbacks_t structure typ = structure "quorum_callbacks_t" let quorum_notify_fn = field quorum_callbacks_t "quorum_notify_fn" (funptr quorum_notification_fn_t) let () = seal quorum_callbacks_t (* binding to libquorum *) let quorum_initialize = foreign "quorum_initialize" (ptr quorum_handle_t @-> ptr quorum_callbacks_t @-> ptr uint32_t @-> returning cs_error_t ) let quorum_finalize = foreign "quorum_finalize" (quorum_handle_t @-> returning cs_error_t) let quorum_dispatch = foreign "quorum_dispatch" (quorum_handle_t @-> CsDispatchFlag.cs_dispatch_flags_t @-> returning cs_error_t ) let quorum_trackstart = foreign "quorum_trackstart" (quorum_handle_t @-> uint @-> returning cs_error_t) let quorum_trackstop = foreign "quorum_trackstop" (quorum_handle_t @-> returning cs_error_t) let quorum_getquorate = foreign "quorum_getquorate" (quorum_handle_t @-> ptr int @-> returning cs_error_t) (* exposed functions *) let getquorate handle = let is_quorate = allocate int 0 in quorum_getquorate handle is_quorate |> to_result >>= fun () -> match !@is_quorate with | 1 -> Ok true | 0 -> Ok false | _ -> Error CsErrOcamlCompat let with_handle f = let qhandle = allocate quorum_handle_t Unsigned.UInt64.zero in let qtype = allocate uint32_t Unsigned.UInt32.zero in quorum_initialize qhandle (from_voidp quorum_callbacks_t null) qtype |> CsError.to_result >>= fun () -> let r = f !@qhandle in quorum_finalize !@qhandle |> CsError.to_result >>= fun () -> r
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>