apt: pkgAcquireStatus Class Reference

apt 3.3.2 commandline package manager

Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
pkgAcquireStatus Class Referenceabstract
Acquire system {{{

A monitor object for downloads controlled by the pkgAcquire class. {{{. More...

`#include <apt-pkg/acquire.h>`

## Classes
struct | ReleaseInfoChange

## Public Member Functions
virtual void | Fetched (unsigned long long Size, unsigned long long ResumePoint)
| Invoked when a local or remote file has been completely fetched.
virtual bool | MediaChange (std::string Media, std::string Drive)=0
| Invoked when the user should be prompted to change the inserted removable media.
virtual bool | ReleaseInfoChanges (metaIndex const *const LastRelease, metaIndex const *const CurrentRelease, std::vector< ReleaseInfoChange > &&Changes)
| ask the user for confirmation of changes to infos about a repository
virtual void | IMSHit (pkgAcquire::ItemDesc &)
| Invoked when an item is confirmed to be up-to-date.
virtual void | Fetch (pkgAcquire::ItemDesc &)
| Invoked when some of an item's data is fetched.
virtual void | Done (pkgAcquire::ItemDesc &)
| Invoked when an item is successfully and completely fetched.
virtual void | Fail (pkgAcquire::ItemDesc &)
| Invoked when the process of fetching an item encounters a fatal error.
virtual bool | Pulse (pkgAcquire *Owner)
| Periodically invoked while the Acquire process is underway.
virtual void | Start ()
| Invoked when the Acquire process starts running.
virtual void | Stop ()
| Invoked when the Acquire process stops running.
| pkgAcquireStatus ()
| Initialize all counters to 0 and the time to the current time.

## Static Public Member Functions
static APT_HIDDEN bool | ReleaseInfoChangesAsGlobalErrors (std::vector< ReleaseInfoChange > &&Changes)

## Public Attributes
bool | Update
| If true, the download scheduler should call Pulse() at the next available opportunity.
bool | MorePulses
| If true, extra Pulse() invocations will be performed.

## Protected Attributes
struct timeval | Time
| The last time at which this monitor object was updated.
struct timeval | StartTime
| The time at which the download started.
unsigned long long | LastBytes
| The number of bytes fetched as of the previous call to pkgAcquireStatus::Pulse, including local items.
unsigned long long | CurrentCPS
| The current rate of download as of the most recent call to pkgAcquireStatus::Pulse, in bytes per second.
unsigned long long | CurrentBytes
| The number of bytes fetched as of the most recent call to pkgAcquireStatus::Pulse, including local items.
unsigned long long | TotalBytes
| The total number of bytes that need to be fetched.
unsigned long long | FetchedBytes
| The total number of bytes accounted for by items that were successfully fetched.
unsigned long long | ElapsedTime
| The amount of time that has elapsed since the download started.
unsigned long | TotalItems
| The total number of items that need to be fetched.
unsigned long | CurrentItems
| The number of items that have been successfully downloaded.
double | Percent
| The estimated percentage of the download (0-100).

## Detailed Description

A monitor object for downloads controlled by the pkgAcquire class. {{{.

Todo
  Why protected members?

## Member Function Documentation

## ◆ Fetched()

void Fetched | ( | unsigned long long | Size,
|  | unsigned long long | ResumePoint )
| virtual

Invoked when a local or remote file has been completely fetched.

Parameters

  Size | The size of the file fetched.
  ResumePoint | How much of the file was already fetched.

References FetchedBytes.

## ◆ IMSHit()

virtual void IMSHit | ( | pkgAcquire::ItemDesc & |  | ) |
| inlinevirtual

Invoked when an item is confirmed to be up-to-date.

For instance, when an HTTP download is informed that the file on the server was not modified.

## ◆ MediaChange()

virtual bool MediaChange | ( | std::string | Media,
|  | std::string | Drive )
| pure virtual

Invoked when the user should be prompted to change the inserted removable media.

This method should not return until the user has confirmed to the user interface that the media change is complete.

Parameters

  Media | The name of the media type that should be changed.
  Drive | The identifying name of the drive whose media should be changed.

Returns
  true if the user confirms the media change, false if it is cancelled.

Todo
  This is a horrible blocking monster; it should be CPSed with prejudice.

## ◆ Pulse()

bool Pulse | ( | pkgAcquire * | Owner | ) |
| virtual

Periodically invoked while the Acquire process is underway.

Subclasses should first call pkgAcquireStatus::Pulse(), then update their status output. The download process is blocked while Pulse() is being called.

Returns
  false if the user asked to cancel the whole Acquire process.

See also
  pkgAcquire::Run

References CurrentBytes, CurrentCPS, CurrentItems, ElapsedTime, pkgAcquire::ItemsBegin(), pkgAcquire::ItemsEnd(), LastBytes, Percent, pkgAcquire::Item::StatDone, Time, TotalBytes, TotalItems, pkgAcquire::WorkersBegin(), and pkgAcquire::WorkerStep().

## ◆ ReleaseInfoChanges()

bool ReleaseInfoChanges | ( | metaIndex const *const | LastRelease,
|  | metaIndex const *const | CurrentRelease,
|  | std::vector< ReleaseInfoChange > && | Changes )
| virtual

ask the user for confirmation of changes to infos about a repository

This method should present the user with a choice of accepting the change or not and indicate the user opinion via the return value. If DefaultAction is true it is acceptable to only notify the user about the change, but to accept the change automatically on behalf of the user.

The default implementation will fail if any Change has DefaultAction == false. Regardless of success it will print for each change the message attached to it via GlobalError either as an error (if DefaultAction == false) or as a notice otherwise.

Parameters

  LastRelease | can be used to extract further information from the previous Release file
  CurrentRelease | can be used to extract further information from the current Release file
  Changes | is an array of changes alongside explanatory messages which should be presented in some way to the user.

Returns
  true if all changes are accepted by user, otherwise or if user can't be asked false

## Member Data Documentation

## ◆ MorePulses

bool MorePulses

If true, extra Pulse() invocations will be performed.

With this option set, Pulse() will be called every time that a download item starts downloading, finishes downloading, or terminates with an error.

Referenced by pkgAcquireStatus().

## ◆ TotalBytes

unsigned long long TotalBytes
| protected

The total number of bytes that need to be fetched.

Warning
  This member is inaccurate, as new items might be enqueued while the download is in progress!

Referenced by Pulse(), and Start().

## ◆ TotalItems

unsigned long TotalItems
| protected

The total number of items that need to be fetched.

Warning
  This member is inaccurate, as new items might be enqueued while the download is in progress!

Referenced by Pulse(), and Start().

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

- apt-pkg/acquire.h
- apt-pkg/acquire.cc