24 #ifndef STORAGE_DEVICE_H
25 #define STORAGE_DEVICE_H
28 #include <libxml/tree.h>
33 #include <boost/noncopyable.hpp>
35 #include "storage/Utils/Exception.h"
73 class Device :
private boost::noncopyable
80 sid_t get_sid()
const;
82 bool operator==(
const Device& rhs)
const;
83 bool operator!=(
const Device& rhs)
const;
100 std::string get_displayname()
const;
102 virtual ResizeInfo detect_resize_info()
const;
104 bool has_children()
const;
105 size_t num_children()
const;
107 bool has_parents()
const;
108 size_t num_parents()
const;
114 std::vector<Device*> get_children();
115 std::vector<const Device*> get_children()
const;
117 std::vector<Device*> get_parents();
118 std::vector<const Device*> get_parents()
const;
120 std::vector<Device*> get_siblings(
bool itself);
121 std::vector<const Device*> get_siblings(
bool itself)
const;
123 std::vector<Device*> get_descendants(
bool itself);
124 std::vector<const Device*> get_descendants(
bool itself)
const;
126 std::vector<Device*> get_ancestors(
bool itself);
127 std::vector<const Device*> get_ancestors(
bool itself)
const;
129 std::vector<Device*> get_leaves(
bool itself);
130 std::vector<const Device*> get_leaves(
bool itself)
const;
132 std::vector<Device*> get_roots(
bool itself);
133 std::vector<const Device*> get_roots(
bool itself)
const;
135 std::vector<Holder*> get_in_holders();
136 std::vector<const Holder*> get_in_holders()
const;
138 std::vector<Holder*> get_out_holders();
139 std::vector<const Holder*> get_out_holders()
const;
141 void remove_descendants();
143 const std::map<std::string, std::string>& get_userdata()
const;
144 void set_userdata(
const std::map<std::string, std::string>& userdata);
146 friend std::ostream& operator<<(std::ostream& out,
const Device& device);
152 Impl& get_impl() {
return *impl; }
153 const Impl& get_impl()
const {
return *impl; }
155 virtual Device* clone()
const = 0;
157 void save(xmlNode* node)
const;
170 const std::unique_ptr<Impl> impl;
bool exists_in_probed() const
Checks if the device exists in the probed devicegraph.
The master container of the libstorage.
Definition: Devicegraph.h:133
bool exists_in_staging() const
Checks if the device exists in the staging devicegraph.
An abstract base class of storage devices, and a vertex in the Devicegraph.
Definition: Device.h:73
Base class for storage exceptions.
Definition: Exception.h:113
The storage namespace.
Definition: Actiongraph.h:36
unsigned int sid_t
An integer storage ID.
Definition: Device.h:64
bool exists_in_devicegraph(const Devicegraph *devicegraph) const
Checks if the device exists in the devicegraph.