vmm_vmmd: introduce and use type 'a create

This commit is contained in:
Hannes Mehnert 2019-01-20 22:04:41 +01:00
parent e58ab236b7
commit 4d3bb777e1
2 changed files with 8 additions and 4 deletions

View file

@ -70,6 +70,9 @@ type service_out = [
type out = [ service_out | `Data of Vmm_commands.wire ] 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 log t name event =
let data = (Ptime_clock.now (), event) in let data = (Ptime_clock.now (), event) in
let header = Vmm_commands.{ version = t.wire_version ; sequence = t.log_counter ; name } in let header = Vmm_commands.{ version = t.wire_version ; sequence = t.log_counter ; name } in

View file

@ -18,17 +18,18 @@ type service_out = [
type out = [ service_out | `Data of Vmm_commands.wire ] 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 -> val handle_shutdown : 'a t -> Name.t -> Unikernel.t ->
[ `Exit of int | `Signal of int | `Stop of int ] -> 'a t * out list [ `Exit of int | `Signal of int | `Stop of int ] -> 'a t * out list
val handle_command : 'a t -> Vmm_commands.wire -> val handle_command : 'a t -> Vmm_commands.wire ->
'a t * out list * '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 | `Loop
| `End | `End
| `Wait of Name.t * out | `Wait of Name.t * out
| `Wait_and_create of Name.t * ('a t -> 'a t * out list * | `Wait_and_create of Name.t * ('a t -> 'a t * out list * [ `Create of 'a create | `End ]) ]
[ `Create of 'a t -> ('a t * out list * Name.t * Unikernel.t, [> Rresult.R.msg ]) result
| `End ]) ]
val killall : 'a t -> bool val killall : 'a t -> bool