1 #ifndef VIRTPP_IMPL_STORAGEVOL_HPP 2 #define VIRTPP_IMPL_STORAGEVOL_HPP 5 #include <libvirt/libvirt.h> 6 #include "../StorageVol.hpp" 7 #include "../Stream.hpp" 13 std::swap(underlying, oth.underlying);
18 constexpr
inline StorageVol::operator bool() const noexcept {
return underlying !=
nullptr; }
22 return virStorageVolDownload(underlying, strm.underlying, offset, length,
to_integral(flags));
25 const auto res = virStorageVolGetConnect(underlying);
32 std::optional<Info> ret;
33 return (virStorageVolGetInfo(underlying, &ret.emplace()) == 0) ? ret : std::nullopt;
36 std::optional<Info> ret;
37 return (virStorageVolGetInfoFlags(underlying, &ret.emplace(),
to_integral(flags)) == 0) ? ret : std::nullopt;
46 return virStorageVolResize(underlying, capacity,
to_integral(flags)) == 0;
49 return virStorageVolUpload(underlying, stream.underlying, offset, length,
to_integral(flags)) == 0;
51 inline bool StorageVol::wipe() noexcept {
return virStorageVolWipe(underlying, 0) == 0; }
58 return StorageVol{virStorageVolCreateXMLFrom(pool.underlying, xmlDesc, clonevol.underlying,
to_integral(flags))};
Definition: Stream.hpp:10
constexpr auto to_integral(E e) noexcept
Definition: Base.hpp:32
~StorageVol() noexcept
Definition: StorageVol.hpp:16
Definition: VolCreateFlag.hpp:10
StoragePool getPool() const noexcept
Definition: StorageVol.hpp:43
Definition: Connection.hpp:47
bool download(Stream &strm, unsigned long long offset, unsigned long long length, DownloadFlag flags) noexcept
Definition: StorageVol.hpp:21
T passive
Definition: utility.hpp:48
bool wipe() noexcept
Definition: StorageVol.hpp:51
bool resize(unsigned long long capacity, ResizeFlag flags) noexcept
Definition: StorageVol.hpp:45
Definition: VolWipeAlgorithm.hpp:10
Definition: VolDeleteFlag.hpp:10
passive< gsl::czstring<> > getName() const noexcept
Definition: StorageVol.hpp:41
auto getInfo() const noexcept-> std::optional< Info >
Definition: StorageVol.hpp:31
Definition: VolUploadFlag.hpp:10
passive< gsl::czstring<> > getKey() const noexcept
Definition: StorageVol.hpp:40
Definition: utility.hpp:122
Definition: AdminConnection.hpp:11
constexpr StorageVol() noexcept=default
bool upload(Stream &stream, unsigned long long offset, unsigned long long length, UploadFlag flags) noexcept
Definition: StorageVol.hpp:48
static StorageVol createXML(StoragePool &pool, gsl::czstring<> xmlDesc, CreateFlag flags) noexcept
Definition: StorageVol.hpp:54
Definition: StoragePool.hpp:11
static StorageVol createXMLFrom(StoragePool &pool, gsl::czstring<> xmlDesc, const StorageVol &clonevol, CreateFlag flags) noexcept
Definition: StorageVol.hpp:57
Definition: StorageVol.hpp:10
Definition: VolInfoFlag.hpp:10
UniqueZstring getXMLDesc() const noexcept
Definition: StorageVol.hpp:44
bool delete_(DeleteFlag flags) noexcept
Definition: StorageVol.hpp:20
Definition: VolResizeFlag.hpp:10
Definition: StorageVol.hpp:64
Connection getConnect() const noexcept
Definition: StorageVol.hpp:24
constexpr StorageVol & operator=(const StorageVol &) noexcept=delete
Definition: VolDownloadFlag.hpp:10
UniqueZstring getPath() const noexcept
Definition: StorageVol.hpp:42
bool wipePattern(WipeAlgorithm algorithm) noexcept
Definition: StorageVol.hpp:52