libzypp 17.31.23
zypp::DiskUsageCounter Class Reference

Compute disk space occupied by packages across partitions/directories. More...

#include <DiskUsageCounter.h>

Classes

class  MountPoint
 Mount point description If block_size is set DiskUsageCoutner will assume half a block_size is wasted per file, in case a package provides detailed isk usage information. More...
 

Public Types

typedef std::set< MountPointMountPointSet
 

Public Member Functions

 DiskUsageCounter ()
 
 DiskUsageCounter (const MountPointSet &mps_r)
 Ctor taking the MountPointSet to compute.
 
void setMountPoints (const MountPointSet &mps_r)
 Set a MountPointSet to compute.
 
const MountPointSetgetMountPoints () const
 Get the current MountPointSet.
 
MountPointSet disk_usage (const ResPool &pool) const
 Compute disk usage if the current transaction woud be commited.
 
MountPointSet disk_usage (sat::Solvable solv_r) const
 Compute disk usage of a single Solvable.
 
MountPointSet disk_usage (const PoolItem &pi_r) const
 
MountPointSet disk_usage (const ResObject::constPtr &obj_r) const
 
MountPointSet disk_usage (const Bitmap &bitmap_r) const
 Compute disk usage of a collection defined by a solvable bitmap.
 
template<class Iterator >
MountPointSet disk_usage (Iterator begin_r, Iterator end_r) const
 Compute disk usage of a collection (convertible by asSolvable).
 

Static Public Member Functions

static MountPointSet detectMountPoints (const std::string &rootdir="/")
 Get mountpoints of system below rootdir If we happen to detect snapshotting btrfs partitions, the MountPoint::growonly hint is set.
 
static MountPointSet justRootPartition ()
 Only one entry for "/" to collect total sizes.
 

Private Attributes

MountPointSet _mps
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &str, const DiskUsageCounter &obj)
 Stream output.
 

Detailed Description

Compute disk space occupied by packages across partitions/directories.

Definition at line 31 of file DiskUsageCounter.h.

Member Typedef Documentation

◆ MountPointSet

Definition at line 153 of file DiskUsageCounter.h.

Constructor & Destructor Documentation

◆ DiskUsageCounter() [1/2]

zypp::DiskUsageCounter::DiskUsageCounter ( )
inline

Definition at line 155 of file DiskUsageCounter.h.

◆ DiskUsageCounter() [2/2]

zypp::DiskUsageCounter::DiskUsageCounter ( const MountPointSet mps_r)
inline

Ctor taking the MountPointSet to compute.

Definition at line 159 of file DiskUsageCounter.h.

Member Function Documentation

◆ setMountPoints()

void zypp::DiskUsageCounter::setMountPoints ( const MountPointSet mps_r)
inline

Set a MountPointSet to compute.

Definition at line 164 of file DiskUsageCounter.h.

◆ getMountPoints()

const MountPointSet & zypp::DiskUsageCounter::getMountPoints ( ) const
inline

Get the current MountPointSet.

Definition at line 168 of file DiskUsageCounter.h.

◆ detectMountPoints()

DiskUsageCounter::MountPointSet zypp::DiskUsageCounter::detectMountPoints ( const std::string &  rootdir = "/")
static

Get mountpoints of system below rootdir If we happen to detect snapshotting btrfs partitions, the MountPoint::growonly hint is set.

Disk usage computation will assume that deleted packages will not free any space (kept in a snapshot).

Definition at line 129 of file DiskUsageCounter.cc.

◆ justRootPartition()

DiskUsageCounter::MountPointSet zypp::DiskUsageCounter::justRootPartition ( )
static

Only one entry for "/" to collect total sizes.

Definition at line 337 of file DiskUsageCounter.cc.

◆ disk_usage() [1/6]

DiskUsageCounter::MountPointSet zypp::DiskUsageCounter::disk_usage ( const ResPool pool) const

Compute disk usage if the current transaction woud be commited.

Definition at line 92 of file DiskUsageCounter.cc.

◆ disk_usage() [2/6]

DiskUsageCounter::MountPointSet zypp::DiskUsageCounter::disk_usage ( sat::Solvable  solv_r) const

Compute disk usage of a single Solvable.

Definition at line 108 of file DiskUsageCounter.cc.

◆ disk_usage() [3/6]

MountPointSet zypp::DiskUsageCounter::disk_usage ( const PoolItem pi_r) const
inline

Definition at line 188 of file DiskUsageCounter.h.

◆ disk_usage() [4/6]

MountPointSet zypp::DiskUsageCounter::disk_usage ( const ResObject::constPtr obj_r) const
inline

Definition at line 191 of file DiskUsageCounter.h.

◆ disk_usage() [5/6]

DiskUsageCounter::MountPointSet zypp::DiskUsageCounter::disk_usage ( const Bitmap bitmap_r) const

Compute disk usage of a collection defined by a solvable bitmap.

Definition at line 120 of file DiskUsageCounter.cc.

◆ disk_usage() [6/6]

template<class Iterator >
MountPointSet zypp::DiskUsageCounter::disk_usage ( Iterator  begin_r,
Iterator  end_r 
) const
inline

Compute disk usage of a collection (convertible by asSolvable).

Definition at line 199 of file DiskUsageCounter.h.

Friends And Related Function Documentation

◆ operator<<()

std::ostream & operator<< ( std::ostream &  str,
const DiskUsageCounter obj 
)
related

Stream output.

Definition at line 221 of file DiskUsageCounter.h.

Member Data Documentation

◆ _mps

MountPointSet zypp::DiskUsageCounter::_mps
private

Definition at line 208 of file DiskUsageCounter.h.


The documentation for this class was generated from the following files: