libstorage-ng
Environment.h
1 /*
2  * Copyright (c) [2014-2015] Novell, Inc.
3  * Copyright (c) 2022 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_ENVIRONMENT_H
25 #define STORAGE_ENVIRONMENT_H
26 
27 
28 #include <string>
29 #include <memory>
30 
31 
32 namespace storage
33 {
34 
36  enum class ProbeMode {
37  STANDARD, // probe system during init
38  STANDARD_WRITE_DEVICEGRAPH, // probe system during init, write devicegraph
39  STANDARD_WRITE_MOCKUP, // probe system during init, write mockup
40  NONE, // no probing - for testsuite
41  READ_DEVICEGRAPH, // fake probe - for testsuite
42  READ_MOCKUP // fake probe - for testsuite
43  };
44 
45 
49  enum class TargetMode {
50 
52  DIRECT,
53 
55  CHROOT,
56 
58  IMAGE
59 
60  };
61 
62 
64  {
65  public:
66 
67  Environment(bool read_only);
68  Environment(bool read_only, ProbeMode probe_mode, TargetMode target_mode);
69  Environment(const Environment& environment);
70  ~Environment();
71 
72  Environment& operator=(const Environment& environment) = delete;
73 
77  bool is_read_only() const;
78 
84  ProbeMode get_probe_mode() const;
85 
92 
102  const std::string& get_rootprefix() const;
103 
111  void set_rootprefix(const std::string& rootprefix);
112 
113  const std::string& get_devicegraph_filename() const;
114  void set_devicegraph_filename(const std::string& devicegraph_filename);
115 
116  const std::string& get_arch_filename() const;
117  void set_arch_filename(const std::string& arch_filename);
118 
119  const std::string& get_mockup_filename() const;
120  void set_mockup_filename(const std::string& mockup_filename);
121 
122  friend std::ostream& operator<<(std::ostream& out, const Environment& environment);
123 
124  public:
125 
126  class Impl;
127 
128  Impl& get_impl() { return *impl; }
129  const Impl& get_impl() const { return *impl; }
130 
131  private:
132 
133  const std::unique_ptr<Impl> impl;
134 
135  };
136 
137 }
138 
139 #endif
Definition: Environment.h:63
ProbeMode get_probe_mode() const
Return the probe mode.
TargetMode get_target_mode() const
return the target mode.
TargetMode
Enum with target modes.
Definition: Environment.h:49
ProbeMode
How to probe the system.
Definition: Environment.h:36
void set_rootprefix(const std::string &rootprefix)
Set the rootprefix.
const std::string & get_rootprefix() const
Query the rootprefix.
The target is image based.
The storage namespace.
Definition: Actiongraph.h:39
The target is chrooted, e.g.
bool is_read_only() const
Return whether the Environment has read-only set.