sbuild  1.7.1
lvm-snapshot.h
1 /* Copyright © 2005-2013 Roger Leigh <rleigh@debian.org>
2  *
3  * schroot is free software: you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7  *
8  * schroot is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see
15  * <http://www.gnu.org/licenses/>.
16  *
17  *********************************************************************/
18 
19 #ifndef SBUILD_CHROOT_FACET_LVM_SNAPSHOT_H
20 #define SBUILD_CHROOT_FACET_LVM_SNAPSHOT_H
21 
22 #include <sbuild/chroot/facet/block-device-base.h>
23 #include <sbuild/chroot/facet/session-setup.h>
24 #include <sbuild/chroot/facet/source-setup.h>
25 
26 namespace sbuild
27 {
28  namespace chroot
29  {
30  namespace facet
31  {
32 
39  public session_setup,
40  public source_setup
41  {
42  public:
44  typedef std::shared_ptr<lvm_snapshot> ptr;
45 
47  typedef std::shared_ptr<const lvm_snapshot> const_ptr;
48 
49  protected:
51  lvm_snapshot ();
52 
54  lvm_snapshot (const lvm_snapshot& rhs);
55 
56  void
58  bool copy);
59 
60  friend class chroot;
61 
62  public:
64  virtual ~lvm_snapshot ();
65 
66  virtual std::string const&
67  get_name () const;
68 
74  static ptr
75  create ();
76 
78  clone () const;
79 
86  std::string const&
87  get_snapshot_device () const;
88 
95  void
96  set_snapshot_device (const std::string& snapshot_device);
97 
104  std::string const&
105  get_snapshot_options () const;
106 
113  void
114  set_snapshot_options (const std::string& snapshot_options);
115 
116  virtual void
117  setup_env (environment& env) const;
118 
119  virtual session_flags
120  get_session_flags () const;
121 
122  protected:
123  virtual void
124  setup_lock (chroot::setup_type type,
125  bool lock,
126  int status);
127 
128  virtual void
129  get_details (format_detail& detail) const;
130 
131  virtual void
132  get_used_keys (string_list& used_keys) const;
133 
134  virtual void
135  get_keyfile (keyfile& keyfile) const;
136 
137  virtual void
138  set_keyfile (const keyfile& keyfile);
139 
140  virtual void
141  chroot_session_setup (const chroot& parent,
142  const std::string& session_id,
143  const std::string& alias,
144  const std::string& user,
145  bool root);
146 
147  virtual void
148  chroot_source_setup (const chroot& parent);
149 
150  private:
152  std::string snapshot_device;
154  std::string snapshot_options;
155  };
156 
157  }
158  }
159 }
160 
161 #endif /* SBUILD_CHROOT_FACET_LVM_SNAPSHOT_H */
162 
163 /*
164  * Local Variables:
165  * mode:C++
166  * End:
167  */