aboutsummaryrefslogtreecommitdiff
path: root/bbot/machine
diff options
context:
space:
mode:
Diffstat (limited to 'bbot/machine')
-rw-r--r--bbot/machine50
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