diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-04-12 15:27:40 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-04-12 15:27:40 +0200 |
commit | 4c7bb136ac8c1c1cd47942ad7fe8257b20997871 (patch) | |
tree | 27353008ece9a85fb7ef6b6106c338b432bda004 /bbot/machine | |
parent | 50579107e3f628c2e3c644d5af01ef67404a0f2a (diff) |
Complete agent side of machine bootstrap
Diffstat (limited to 'bbot/machine')
-rw-r--r-- | bbot/machine | 38 |
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). |