summaryrefslogtreecommitdiffstats
path: root/generator/generator_xdr.ml
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2011-04-01 15:50:33 +0100
committerRichard W.M. Jones <rjones@redhat.com>2011-04-01 16:05:45 +0100
commit40f7323134e058c0920caa18c667ea99a4c8b3e8 (patch)
tree01876dc75ebac380ce75855ddfbb5e9b6cd26b88 /generator/generator_xdr.ml
parent6e5f64089631622167e60df25ee009ef83df5170 (diff)
downloadlibguestfs-40f7323134e058c0920caa18c667ea99a4c8b3e8.tar.gz
libguestfs-40f7323134e058c0920caa18c667ea99a4c8b3e8.tar.xz
libguestfs-40f7323134e058c0920caa18c667ea99a4c8b3e8.zip
daemon: Introduce "pulse mode" progress events.
This introduces a new form of progress event, where we don't know how much of the operation has taken place, but we nevertheless want to send back some indication of activity. Some progress bar indicators directly support this, eg. GtkProgressBar where it is known as "pulse mode". A pulse mode progress message is a special backwards-compatible form of the ordinary progress message. No change is required in callers, unless they want to add support for pulse mode. The daemon sends: - zero or more progress messages with position = 0, total = 1 - a single final progress message with position = total = 1 Note that the final progress message may not be sent if the call fails and returns an error. This is consistent with the behaviour of ordinary progress messages. The daemon allows two types of implementation. Either you can just call notify_progress (0, 1); ...; notify_progress (1, 1) as usual. Or you can call the functions pulse_mode_start, pulse_mode_end and/or pulse_mode_cancel (see documentation in daemon/daemon.h). For this second form of call, the guarantee is very weak: it *just* says the daemon is still capable of doing something, and it doesn't imply that if there is a subprocess that it is doing anything. However this does make it very easy to add pulse mode progress messages to all sorts of existing calls that depend on long-running external commands. To do: add a third variant that monitors a subprocess and only sends back progress messages if it's doing something, where "doing something" might indicate it's using CPU time or it's printing output.
Diffstat (limited to 'generator/generator_xdr.ml')
-rw-r--r--generator/generator_xdr.ml10
1 files changed, 8 insertions, 2 deletions
diff --git a/generator/generator_xdr.ml b/generator/generator_xdr.ml
index 5714c803..07f3ff97 100644
--- a/generator/generator_xdr.ml
+++ b/generator/generator_xdr.ml
@@ -1,5 +1,5 @@
(* libguestfs
- * Copyright (C) 2009-2010 Red Hat Inc.
+ * Copyright (C) 2009-2011 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -214,8 +214,14 @@ struct guestfs_chunk {
* 'position' and 'total' have undefined units; however they may
* have meaning for some calls.
*
- * NB. guestfs___recv_from_daemon assumes the XDR-encoded
+ * Notes:
+ *
+ * (1) guestfs___recv_from_daemon assumes the XDR-encoded
* structure is 24 bytes long.
+ *
+ * (2) daemon/proto.c:async_safe_send_pulse assumes the progress
+ * message is laid out precisely in this way. So if you change
+ * this then you'd better change that function as well.
*/
struct guestfs_progress {
guestfs_procedure proc; /* @0: GUESTFS_PROC_x */