Module Libvirt.Job


module Job: sig .. end
Module dealing with asynchronous jobs.

type ('a, 'b) t = ('a, 'b) Libvirt.job_t 
A background asynchronous job.

Jobs represent a pending operation such as domain creation. The possible types for a job are:

(`Domain, `W) Job.t            Job creating a new domain
(`Domain_nocreate, `W) Job.t   Job acting on an existing domain
(`Network, `W) Job.t           Job creating a new network
(`Network_nocreate, `W) Job.t  Job acting on an existing network


type job_type =
| Bounded
| Unbounded (*A Bounded job is one where we can estimate time to completion.*)

type job_state =
| Running
| Complete
| Failed
| Cancelled (*State of the job.*)

type job_info = {
   typ : job_type; (*Job type (Bounded, Unbounded)*)
   state : job_state; (*Job state (Running, etc.)*)
   running_time : int; (*Actual running time (seconds)*)
   remaining_time : int; (*Estimated time left (seconds)*)
   percent_complete : int; (*Estimated percent complete*)
}
val get_info : ('a, 'b) t -> job_info
Get information and status about the job.
val get_domain : ([ `Domain ], 'a) t -> 'a Libvirt.Domain.t
Get the completed domain from a job.

You should only call it on a job in state Complete.

val get_network : ([ `Network ], 'a) t -> 'a Libvirt.Network.t
Get the completed network from a job.

You should only call it on a job in state Complete.

val cancel : ('a, 'b) t -> unit
Cancel a job.
val free : ('a, [> `R ]) t -> unit
Free a job object in memory.

The job object is automatically freed if it is garbage collected. This function just forces it to be freed right away.

val const : ('a, [> `R ]) t -> ('a, Libvirt.ro) t
const conn turns a read/write job into a read-only job. Note that the opposite operation is impossible.