aboutsummaryrefslogtreecommitdiff
path: root/bbot/machine
blob: c2942ac3e26855eec49fcb1eb34e3ca3675fa7dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// file      : bbot/machine -*- C++ -*-
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license   : TBC; 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,
                 const string& br_iface,
                 uint16_t tftp_port);
}

#endif // BBOT_MACHINE