12#ifndef ZYPP_DISKUSAGE_COUNTER_H
13#define ZYPP_DISKUSAGE_COUNTER_H
61 Hint_readonly = (1<<0),
62 Hint_growonly = (1<<1),
68 std::string
f = std::string(),
69 long long bs = 0
LL,
long long total = 0
LL,
long long used = 0
LL,
long long pkg = 0
LL,
72 , block_size(
bs), total_size(total), used_size(
used), pkg_size(
pkg)
73 , readonly(
hints.testFlag(Hint_readonly))
74 , growonly(
hints.testFlag(Hint_growonly))
82 const std::string &
f = std::string(),
83 long long bs = 0
LL,
long long total = 0
LL,
long long used = 0
LL,
long long pkg = 0
LL,
91 long long bs,
long long total = 0
LL,
long long used = 0
LL,
long long pkg = 0
LL,
97 long long bs,
long long total = 0
LL,
long long used = 0
LL,
long long pkg = 0
LL,
122 {
return dir < rhs.
dir; }
126 {
return ByteCount( block_size, ByteCount::B ); }
130 {
return ByteCount( total_size, ByteCount::K ); }
134 {
return ByteCount( used_size, ByteCount::K ); }
138 {
return ByteCount( total_size-used_size, ByteCount::K ); }
142 {
return ByteCount( pkg_size, ByteCount::K ); }
146 {
return ByteCount( total_size-pkg_size, ByteCount::K ); }
150 {
return ByteCount( pkg_size-used_size, ByteCount::K ); }
177 static MountPointSet detectMountPoints(
const std::string &
rootdir =
"/" );
180 static MountPointSet justRootPartition();
184 MountPointSet disk_usage(
const ResPool & pool )
const;
199 template<
class Iterator>
205 return disk_usage(
bitmap );
223 {
return str <<
obj.getMountPoints(); }
std::ostream & operator<<(std::ostream &str, const zypp::sat::detail::CDataiterator *obj)
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Store and operate with byte count.
Compute disk space occupied by packages across partitions/directories.
const MountPointSet & getMountPoints() const
Get the current MountPointSet.
MountPointSet disk_usage(Iterator begin_r, Iterator end_r) const
Compute disk usage of a collection (convertible by asSolvable).
void setMountPoints(const MountPointSet &mps_r)
Set a MountPointSet to compute.
MountPointSet disk_usage(const PoolItem &pi_r) const
std::set< MountPoint > MountPointSet
MountPointSet disk_usage(const ResObject::constPtr &obj_r) const
DiskUsageCounter(MountPointSet mps_r)
Ctor taking the MountPointSet to compute.
std::ostream & operator<<(std::ostream &str, const DiskUsageCounter &obj)
Stream output.
Combining sat::Solvable and ResStatus.
TraitsType::constPtrType constPtr
Libsolv (bit)Map wrapper.
static constexpr PoolSizeType poolSize
An object indicating the bitmap should match the current pools capacity.
A Solvable object within the sat Pool.
String related utilities and Regular expression matching.
Easy-to use interface to the ZYPP dependency resolver.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Mount point description If block_size is set DiskUsageCoutner will assume half a block_size is wasted...
MountPoint(const std::string &d, long long bs, long long total=0LL, long long used=0LL, long long pkg=0LL, HintFlags hints=NoHint)
Ctor initialize directory and sizes.
long long used_size
Used size of the filesystem in KiB (0 if you don't care)
MountPoint(const std::string &d, Hint hint)
ByteCount commitDiff() const
Size change due to installation as ByteCount for convenience.
MountPoint(const std::string &d, HintFlags hints)
Ctor just name and hints, all sizes 0.
ZYPP_DECLARE_FLAGS(HintFlags, Hint)
ByteCount usedSize() const
Used size of the filesystem as ByteCount for convenience.
ByteCount freeSize() const
Free size of the filesystem as ByteCount for convenience.
MountPoint(const char *d, const std::string &f=std::string(), long long bs=0LL, long long total=0LL, long long used=0LL, long long pkg=0LL, HintFlags hints=NoHint)
long long block_size
Block size of the filesystem in B (0 if you don't care)
MountPoint(const char *d, HintFlags hints)
ByteCount freeAfterCommit() const
Free size after installation as ByteCount for convenience.
long long total_size
Total size of the filesystem in KiB (0 if you don't care)
MountPoint(const char *d, long long bs, long long total=0LL, long long used=0LL, long long pkg=0LL, HintFlags hints=NoHint)
bool readonly
hint for readonly partitions
std::string dir
Directory name.
ByteCount blockSize() const
Block size of the filesystem as ByteCount for convenience.
MountPoint(const char *d, Hint hint)
long long pkg_size
Used size after installation in KiB (computed by DiskUsageCoutner)
bool growonly
hint for growonly partitions (e.g. snapshotting btrfs)
bool operator<(const MountPoint &rhs) const
Sort by directory name.
ByteCount usedAfterCommit() const
Used size after installation as ByteCount for convenience.
MountPoint(std::string d="/", std::string f=std::string(), long long bs=0LL, long long total=0LL, long long used=0LL, long long pkg=0LL, HintFlags hints=NoHint)
Ctor initialize directory, fstype and sizes.
std::string fstype
Filesystem type (provided by detectMountPoints)
ByteCount totalSize() const
Total size of the filesystem as ByteCount for convenience.
To Solvable transform functor.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
#define ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Name)