-
Notifications
You must be signed in to change notification settings - Fork 468
/
Copy pathclDockerDriver.h
74 lines (64 loc) · 2.09 KB
/
clDockerDriver.h
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef CLDOCKERBUILDER_H
#define CLDOCKERBUILDER_H
#include "clDockerWorkspaceSettings.h"
#include "cl_command_event.h"
#include <wx/event.h>
#include <wx/filename.h>
#include <wx/sharedptr.h>
#include <unordered_set>
class Docker;
class IProcess;
class clDockerDriver : public wxEvtHandler
{
protected:
enum eContext {
kNone = -1,
kBuild,
kRun,
kListContainers,
kKillContainers,
kListImages,
kDeleteUnusedImages,
kContext_StartContainer,
kContext_StopContainer,
};
protected:
std::unordered_set<IProcess*> m_processes;
Docker* m_plugin;
eContext m_context = kNone;
wxString m_output;
protected:
void OnProcessOutput(clProcessEvent& event);
void OnProcessTerminated(clProcessEvent& event);
protected:
void StartProcessAsync(const wxString& command, const wxString& wd, size_t flags, clDockerDriver::eContext context);
wxString StartProcessSync(const wxString& command, const wxString& wd, size_t flags);
wxString GetDockerExe() const;
void ProcessListContainersCommand();
void ProcessListImagesCommand();
void DoListContainers();
void DoListImages();
public:
typedef wxSharedPtr<clDockerDriver> Ptr_t;
clDockerDriver(Docker* plugin);
virtual ~clDockerDriver();
void Build(const wxFileName& filepath, const clDockerWorkspaceSettings& settings);
void Run(const wxFileName& filepath, const clDockerWorkspaceSettings& settings);
bool IsRunning() const { return !m_processes.empty(); }
void Stop();
//===------------------
// Images API
//===------------------
void ClearUnusedImages();
void ListImages();
//===------------------
// Containers API
//===------------------
void ListContainers();
void RemoveContainers(const wxArrayString& ids);
void ExecContainerCommand(const wxString& containerName, const wxString& containerCommand);
void AttachTerminal(const wxArrayString& names);
void StopContainer(const wxString& containerName);
void StartContainer(const wxString& containerName);
};
#endif // CLDOCKERBUILDER_H