From 2b4e898407d2b74906347be3f54a45766b75d19f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Wed, 8 Nov 2017 11:47:08 +0100 Subject: [PATCH] Distributed_db: use a record instead of a tuple. --- src/node/shell/distributed_db_functors.ml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/node/shell/distributed_db_functors.ml b/src/node/shell/distributed_db_functors.ml index cde6c9cf8..272a1f161 100644 --- a/src/node/shell/distributed_db_functors.ml +++ b/src/node/shell/distributed_db_functors.ml @@ -106,7 +106,8 @@ end = struct } and status = - | Pending of value Lwt.u * param + | Pending of { wakener : value Lwt.u ; + param : param } | Found of value let known s k = @@ -157,16 +158,16 @@ end = struct match Memory_table.find s.memory k with | exception Not_found -> begin let waiter, wakener = Lwt.wait () in - Memory_table.add s.memory k (Pending (wakener, param)) ; + Memory_table.add s.memory k (Pending { wakener ; param }) ; Scheduler.request s.scheduler peer k ; waiter end - | Pending (w, _) -> + | Pending { wakener = w ; _ } -> Scheduler.request s.scheduler peer k ; Lwt.waiter_of_wakener w | Found v -> Lwt.return v end - | Pending (w, _) -> + | Pending { wakener = w ; _ } -> Scheduler.request s.scheduler peer k ; Lwt.waiter_of_wakener w | Found v -> Lwt.return v @@ -184,7 +185,7 @@ end = struct Scheduler.notify_unrequested s.scheduler p k ; Lwt.return_unit end - | Pending (w, param) -> begin + | Pending { wakener = w ; param } -> begin match Precheck.precheck k param v with | None -> Scheduler.notify_invalid s.scheduler p k ; @@ -219,7 +220,7 @@ end = struct let clear_or_cancel s k = match Memory_table.find s.memory k with | exception Not_found -> () - | Pending (w, _) -> + | Pending { wakener = w ; _ } -> Scheduler.notify_cancelation s.scheduler k ; Memory_table.remove s.memory k ; Lwt.wakeup_later_exn w Lwt.Canceled