aboutsummaryrefslogtreecommitdiff
path: root/bbot/machine
diff options
context:
space:
mode:
Diffstat (limited to 'bbot/machine')
-rw-r--r--bbot/machine38
1 files changed, 34 insertions, 4 deletions
diff --git a/bbot/machine b/bbot/machine
index c2942ac..f99d11b 100644
--- a/bbot/machine
+++ b/bbot/machine
@@ -12,21 +12,51 @@ namespace bbot
{
// A running build machine (container, vm, etc).
//
+ // Note that if the machine is destroyed while it is still running, the
+ // destructor will block until the machine process terminates.
+ //
class machine
{
public:
- // Shut the machine down cleanly. Return false if machine is still
- // running, true if machine exited successfully, and throw failed
- // otherwise.
+ // Shut the machine down cleanly waiting up to the specified number of
+ // seconds for completion. Update the timeout and return false if the
+ // machine is still running, true if the machine exited successfully, and
+ // throw failed otherwise.
//
virtual bool
- shutdown () = 0;
+ shutdown (size_t& seconds) = 0;
// Force the machine down.
//
virtual void
forcedown () = 0;
+ // Suspend the machine.
+ //
+ virtual void
+ suspend () = 0;
+
+ // Wait for the machine to terminate up to the specified number of
+ // seconds. Update the timeout and return false if the machine is still
+ // running, true if the machine exited successfully, and throw failed
+ // otherwise.
+ //
+ virtual bool
+ wait (size_t& seconds) = 0;
+
+ bool
+ wait ()
+ {
+ size_t sec (~0); // Wait indefinitely.
+ return wait (sec);
+ }
+
+ // Print information about the machine (as info diagnostics) that can be
+ // useful for debugging (e.g., how to connect/login, etc).
+ //
+ virtual void
+ print_info (diag_record&) = 0;
+
public:
const string mac; // MAC address (inside the machine).