libstorage-ng
Toggle main menu visibility
Loading...
Searching...
No Matches
Remote.h
1
/*
2
* Copyright (c) 2015 Novell, Inc.
3
* Copyright (c) [2019-2023] SUSE LLC
4
*
5
* All Rights Reserved.
6
*
7
* This program is free software; you can redistribute it and/or modify it
8
* under the terms of version 2 of the GNU General Public License as published
9
* by the Free Software Foundation.
10
*
11
* This program is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14
* more details.
15
*
16
* You should have received a copy of the GNU General Public License along
17
* with this program; if not, contact Novell, Inc.
18
*
19
* To contact Novell about this file by physical or electronic mail, you may
20
* find current contact information at www.novell.com.
21
*/
22
23
24
#ifndef STORAGE_REMOTE_H
25
#define STORAGE_REMOTE_H
26
27
28
#include <string>
29
#include <vector>
30
31
32
// TODO the classnames are bad since the classes for also used in Mockup
33
// TODO swig does not support nested classes so here are currently ugly names
34
35
namespace
storage
36
{
37
41
struct
RemoteCommand
42
{
43
RemoteCommand() =
default
;
44
RemoteCommand(
const
std::vector<std::string>& stdout)
45
: stdout(stdout) {}
46
RemoteCommand(
const
std::vector<std::string>& stdout,
47
const
std::vector<std::string>& stderr,
int
exit_code)
48
: stdout(stdout), stderr(stderr), exit_code(exit_code) {}
49
50
std::vector<std::string> stdout;
51
std::vector<std::string> stderr;
52
int
exit_code = 0;
53
57
bool
operator==
(
const
RemoteCommand& rhs)
const
;
58
};
59
60
64
struct
RemoteFile
65
{
66
RemoteFile() =
default
;
67
RemoteFile(
const
std::vector<std::string>& content) : content(content) {}
68
69
std::vector<std::string> content;
70
74
bool
operator==
(
const
RemoteFile& rhs)
const
;
75
};
76
77
78
class
RemoteCallbacks
79
{
80
public
:
81
82
virtual
~RemoteCallbacks
() {}
83
84
virtual
RemoteCommand
get_command(
const
std::string& name)
const
= 0;
85
virtual
RemoteFile
get_file(
const
std::string& name)
const
= 0;
86
87
};
88
89
90
class
RemoteCallbacksV2
:
public
RemoteCallbacks
91
{
92
public
:
93
94
virtual
~RemoteCallbacksV2
() {}
95
96
virtual
RemoteCommand
get_command_v2(
const
std::vector<std::string>& args)
const
= 0;
97
98
};
99
100
const
RemoteCallbacks
* get_remote_callbacks();
101
void
set_remote_callbacks(
const
RemoteCallbacks
* remote_callbacks);
102
103
}
104
105
106
#endif
storage::RemoteCallbacksV2
Definition
Remote.h:91
storage::RemoteCallbacks
Definition
Remote.h:79
storage
The storage namespace.
Definition
Actiongraph.h:40
storage::RemoteCommand
A result of an unnamed command: stdout + stderr + exit_code.
Definition
Remote.h:42
storage::RemoteCommand::operator==
bool operator==(const RemoteCommand &rhs) const
Compare stdout, stderr and exit_code of two RemoteCommands.
storage::RemoteFile
Contents of an unnamed file (vector of lines).
Definition
Remote.h:65
storage::RemoteFile::operator==
bool operator==(const RemoteFile &rhs) const
Compare content of two Remotefiles.
storage
Utils
Remote.h
Generated by
1.17.0