apt: pkgAcqArchive Class Reference

apt 3.3.0 commandline package manager

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
pkgAcqArchive Class Reference
Acquire system {{{

An item that is responsible for fetching a package file. {{{. More...

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

Inheritance diagram for pkgAcqArchive:

## Public Member Functions
void | Failed (std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override
| Invoked by the acquire worker when the object couldn't be fetched.
void | Done (std::string const &Message, HashStringList const &Hashes, pkgAcquire::MethodConfig const *Cnf) override
| Invoked by the acquire worker when the object was fetched successfully.
std::string | DescURI () const override
| A "descriptive" URI-like string.
std::string | ShortDesc () const override
| Short item description.
void | Finished () override
| Invoked by the worker when the download is completely done.
bool | IsTrusted () const override
HashStringList | GetExpectedHashes () const override
bool | HashesRequired () const override
| pkgAcqArchive (pkgAcquire *const Owner, pkgSourceList *const Sources, pkgRecords *const Recs, pkgCache::VerIterator const &Version, std::string &StoreFilename)
| Create a new pkgAcqArchive.
Public Member Functions inherited from pkgAcquire::Item
APT_HIDDEN void | FailMessage (std::string const &Message)
virtual bool | VerifyDone (std::string const &Message, pkgAcquire::MethodConfig const *const Cnf)
| Invoked by the acquire worker to check if the successfully fetched object is also the objected we wanted to have.
virtual void | Start (std::string const &Message, unsigned long long const Size)
| Invoked when the worker starts to fetch this object.
virtual std::string | Custom600Headers () const
| Custom headers to be sent to the fetch process.
APT_HIDDEN std::unordered_map< std::string, std::string > & | ModifyCustomFields ()
APT_HIDDEN bool | PopAlternativeURI (std::string &NewURI)
APT_HIDDEN bool | IsGoodAlternativeURI (std::string const &AltUri) const
APT_HIDDEN void | PushAlternativeURI (std::string &&NewURI, std::unordered_map< std::string, std::string > &&fields, bool const at_the_back)
APT_HIDDEN void | RemoveAlternativeSite (std::string const &AltUri)
APT_HIDDEN void | Cancelled ()
| Invoked by the worker when the download is cancelled before completion.
std::string | HashSum () const
pkgAcquire * | GetOwner () const
pkgAcquire::ItemDesc & | GetItemDesc ()
void | SetActiveSubprocess (std::string const &subprocess)
| Set the name of the current active subprocess.
| Item (pkgAcquire *const Owner)
| Initialize an item.
virtual | ~Item ()
| Remove this item from its owner's queue by invoking pkgAcquire::Remove.
bool APT_HIDDEN | IsRedirectionLoop (std::string const &NewURI)
int APT_HIDDEN | Priority ()
| The priority of the item, used for queuing.
void APT_HIDDEN | FetchAfter (time_point FetchAfter)
| internal clock definitions to avoid typing all that all over the place
time_point APT_HIDDEN | FetchAfter ()
Public Member Functions inherited from WeakPointable
void | AddWeakPointer (WeakPointable **weakptr)
void | RemoveWeakPointer (WeakPointable **weakptr)
| ~WeakPointable ()

## Protected Member Functions
bool | QueueNext ()
| Queue up the next available file for this version.
std::string | GetFinalFilename () const override
| Get the full pathname of the final file for the current URI.
Protected Member Functions inherited from pkgAcquire::Item
bool | RenameOnError (RenameOnErrorState const state)
| Rename failed file and set error.
virtual bool | QueueURI (ItemDesc &Item)
| Insert this item into its owner's queue.
void | Dequeue ()
| Remove this item from its owner's queue.
bool | Rename (std::string const &From, std::string const &To)
| Rename a file without modifying its timestamp.

## Protected Attributes
pkgCache::VerIterator | Version
| The package version being fetched.
pkgSourceList * | Sources
| The list of sources from which to pick archives to download this package from.
pkgRecords * | Recs
| A package records object, used to look up the file corresponding to each version of the package.
std::string & | StoreFilename
| A location in which the actual filename of the package should be stored.
bool | Trusted
| true if this version file is being downloaded from a trusted source.
Protected Attributes inherited from pkgAcquire::Item
pkgAcquire *const | Owner
| The acquire object with which this item is associated.
pkgAcquire::ItemDesc | Desc
| The item that is currently being downloaded.

## Additional Inherited Members
Public Types inherited from pkgAcquire::Item
enum | ItemState { StatIdle , StatFetching , StatDone , StatError , StatAuthError , StatTransientNetworkError }
| The current status of this item. More...
Public Attributes inherited from pkgAcquire::Item
enum pkgAcquire::Item::ItemState | Status
std::string | ErrorText
| Contains a textual description of the error encountered if ItemState is StatError or StatAuthError.
unsigned long long | FileSize
| The size of the object to fetch.
unsigned long long | PartialSize
| How much of the object was already fetched.
std::string | ActiveSubprocess
| contains the name of the subprocess that is operating on this object (for instance, "gzip", "rred" or "gpgv"). This is obsoleting #Mode from above as it can manage the lifetime of included string properly.
unsigned long | ID
| A client-supplied unique identifier.
bool | Complete
| If true, the entire object has been successfully fetched.
bool | Local
| If true, the URI of this object is "local".
std::string | UsedMirror
unsigned int | QueueCounter
| The number of fetch queues into which this item has been inserted.
unsigned int | ExpectedAdditionalItems
| The number of additional fetch items that are expected once this item is done.
std::string | DestFile
| The name of the file into which the retrieved object will be written.
unsigned int | Retries
| Number of retries.
Protected Types inherited from pkgAcquire::Item
enum | RenameOnErrorState { HashSumMismatch , SizeMismatch , InvalidFormat , SignatureError , NotClearsigned , MaximumSizeExceeded , PDiffError }

## Detailed Description

An item that is responsible for fetching a package file. {{{.

If the package file already exists in the cache, nothing will be done.

## Constructor & Destructor Documentation

## ◆ pkgAcqArchive()

pkgAcqArchive | ( | pkgAcquire *const | Owner,
|  | pkgSourceList *const | Sources,
|  | pkgRecords *const | Recs,
|  | pkgCache::VerIterator const & | Version,
|  | std::string & | StoreFilename )

Create a new pkgAcqArchive.

Parameters

  | Owner | The pkgAcquire object with which this item is associated.
  | Sources | The sources from which to download version files.
  | Recs | A package records object, used to look up the file corresponding to each version of the package.
  | Version | The package version to download.
  [out] | StoreFilename | A location in which the actual filename of the package should be stored. It will be set to a guessed basename in the constructor, and filled in with a fully qualified filename once the download finishes.

References pkgAcquire::Item::Item(), pkgAcquire::Item::Owner, Recs, Sources, StoreFilename, Trusted, and Version.

## Member Function Documentation

## ◆ DescURI()

std::string DescURI | ( |  | ) | const
| nodiscardoverridevirtual

A "descriptive" URI-like string.

Returns
  a URI that should be used to describe what is being fetched.

Implements pkgAcquire::Item.

References pkgAcquire::Item::Desc.

## ◆ Done()

void Done | ( | std::string const & | Message,
|  | HashStringList const & | Hashes,
|  | pkgAcquire::MethodConfig const * | Cnf )
| overridevirtual

Invoked by the acquire worker when the object was fetched successfully.

Note that the object might not have been written to DestFile; check for the presence of an Alt-Filename entry in Message to find the file to which it was really written.

Done is often used to switch from one stage of the processing to the next (e.g. fetching, unpacking, copying). It is one branch of the continuation of the fetch process.

Parameters

  Message | Data from the acquire method. Use LookupTag() to parse it.
  Hashes | The HashSums of the object that was fetched.
  Cnf | The method via which the object was fetched.

See also
  pkgAcqMethod

Reimplemented from pkgAcquire::Item.

References pkgAcquire::Item::Complete, pkgAcquire::Item::DestFile, GetFinalFilename(), pkgAcquire::Item::Local, pkgAcquire::Item::Rename(), and StoreFilename.

## ◆ Failed()

void Failed | ( | std::string const & | Message,
|  | pkgAcquire::MethodConfig const * | Cnf )
| overridevirtual

Invoked by the acquire worker when the object couldn't be fetched.

This is a branch of the continuation of the fetch process.

Parameters

  Message | An RFC822-formatted message from the acquire method describing what went wrong. Use LookupTag() to parse it.
  Cnf | The method via which the worker tried to fetch this object.

See also
  pkgAcqMethod

Reimplemented from pkgAcquire::Item.

## ◆ Finished()

void Finished | ( |  | ) |
| overridevirtual

Invoked by the worker when the download is completely done.

Reimplemented from pkgAcquire::Item.

References pkgAcquire::Item::Complete, pkgAcquire::Item::StatDone, and StoreFilename.

## ◆ GetExpectedHashes()

HashStringList GetExpectedHashes | ( |  | ) | const
| nodiscardoverridevirtual

Returns
  HashSums the DestFile is supposed to have in this stage

Implements pkgAcquire::Item.

## ◆ GetFinalFilename()

std::string GetFinalFilename | ( |  | ) | const
| nodiscardoverrideprotectedvirtual

Get the full pathname of the final file for the current URI.

Reimplemented from pkgAcquire::Item.

References StoreFilename.

Referenced by Done().

## ◆ HashesRequired()

APT_PURE bool HashesRequired | ( |  | ) | const
| nodiscardoverridevirtual

Returns
  if having no hashes is a hard failure or not

Idealy this is always true for every subclass, but thanks to historical grow we don't have hashes for all files in all cases in all steps, so it is slightly more complicated than it should be.

Reimplemented from pkgAcquire::Item.

## ◆ IsTrusted()

APT_PURE bool IsTrusted | ( |  | ) | const
| nodiscardoverridevirtual

Returns
  true if this object is being fetched from a trusted source.

Reimplemented from pkgAcquire::Item.

References Trusted.

## ◆ ShortDesc()

std::string ShortDesc | ( |  | ) | const
| nodiscardoverridevirtual

Short item description.

Returns
  a brief description of the object being fetched.

Reimplemented from pkgAcquire::Item.

References pkgAcquire::Item::Desc.

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

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