diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-04-10 13:16:11 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-04-10 13:16:11 +0200 |
commit | 810df40a0625835ad17a0a5bf3232a8d1a68e680 (patch) | |
tree | 1dc320fd821ce30a0a037b7fae151e1f027d0bbd /bbot/machine | |
parent | 36e0c88e7a3912c8a2e6594841172adb9c14525b (diff) |
Implement vm startup and shutdown
Diffstat (limited to 'bbot/machine')
-rw-r--r-- | bbot/machine | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/bbot/machine b/bbot/machine new file mode 100644 index 0000000..5ab8c15 --- /dev/null +++ b/bbot/machine @@ -0,0 +1,50 @@ +// file : bbot/machine -*- C++ -*- +// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#ifndef BBOT_MACHINE +#define BBOT_MACHINE + +#include <bbot/types> +#include <bbot/utility> + +namespace bbot +{ + // A running build machine (container, vm, etc). + // + class machine + { + public: + // Shut the machine down cleanly. Return false if machine is still + // running, true if machine exited successfully, and throw failed + // otherwise. + // + virtual bool + shutdown () = 0; + + // Force the machine down. + // + virtual void + forcedown () = 0; + + public: + const string mac; // MAC address (inside the machine). + + public: + virtual + ~machine () = default; + + protected: + machine (string m) + : mac (move (m)) {} + }; + + class machine_manifest; + + unique_ptr<machine> + start_machine (const dir_path&, + const machine_manifest&, + const optional<string>& mac); +} + +#endif // BBOT_MACHINE |