From 4d3bb777e1ad93e365f258f6c3085dfea7f01312 Mon Sep 17 00:00:00 2001 From: Hannes Mehnert Date: Sun, 20 Jan 2019 22:04:41 +0100 Subject: [PATCH] vmm_vmmd: introduce and use type 'a create --- src/vmm_vmmd.ml | 3 +++ src/vmm_vmmd.mli | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/vmm_vmmd.ml b/src/vmm_vmmd.ml index 542117e..512ee63 100644 --- a/src/vmm_vmmd.ml +++ b/src/vmm_vmmd.ml @@ -70,6 +70,9 @@ type service_out = [ type out = [ service_out | `Data of Vmm_commands.wire ] +type 'a create = + 'a t -> ('a t * out list * Name.t * Unikernel.t, [ `Msg of string ]) result + let log t name event = let data = (Ptime_clock.now (), event) in let header = Vmm_commands.{ version = t.wire_version ; sequence = t.log_counter ; name } in diff --git a/src/vmm_vmmd.mli b/src/vmm_vmmd.mli index b5a9cca..f81a9b4 100644 --- a/src/vmm_vmmd.mli +++ b/src/vmm_vmmd.mli @@ -18,17 +18,18 @@ type service_out = [ type out = [ service_out | `Data of Vmm_commands.wire ] +type 'a create = + 'a t -> ('a t * out list * Name.t * Unikernel.t, [ `Msg of string ]) result + val handle_shutdown : 'a t -> Name.t -> Unikernel.t -> [ `Exit of int | `Signal of int | `Stop of int ] -> 'a t * out list val handle_command : 'a t -> Vmm_commands.wire -> 'a t * out list * - [ `Create of 'a t -> ('a t * out list * Name.t * Unikernel.t, [> `Msg of string ]) result + [ `Create of 'a create | `Loop | `End | `Wait of Name.t * out - | `Wait_and_create of Name.t * ('a t -> 'a t * out list * - [ `Create of 'a t -> ('a t * out list * Name.t * Unikernel.t, [> Rresult.R.msg ]) result - | `End ]) ] + | `Wait_and_create of Name.t * ('a t -> 'a t * out list * [ `Create of 'a create | `End ]) ] val killall : 'a t -> bool