pkgAcqMetaBase Class Reference
Acquire system {{{

the manager of a transaction More...

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

Inheritance diagram for pkgAcqMetaBase:
[legend]
Collaboration diagram for pkgAcqMetaBase:
[legend]

## Public Member Functions

bool | QueueURI (pkgAcquire::ItemDesc &Item) override
| Insert this item into its owner's queue.
HashStringList | GetExpectedHashes () const override
bool | HashesRequired () const override
void | Add (pkgAcqTransactionItem *const I)
void | AbortTransaction ()
bool | TransactionHasError () const
void | CommitTransaction ()
void | TransactionStageCopy (pkgAcqTransactionItem *const I, const std::string &From, const std::string &To)
| Stage (queue) a copy action when the transaction is committed.
void | TransactionStageRemoval (pkgAcqTransactionItem *const I, const std::string &FinalFile)
| Stage (queue) a removal action when the transaction is committed.
std::string | GetFinalFilename () const override
| Get the full pathname of the final file for the current URI.
| pkgAcqMetaBase (pkgAcquire *const Owner, pkgAcqMetaClearSig *const TransactionManager, IndexTarget const &DataTarget) APT_NONNULL(2
Public Member Functions inherited from pkgAcqTransactionItem
std::string | DescURI () const override
| A "descriptive" URI-like string.
HashStringList | GetExpectedHashes () const override
virtual std::string | GetMetaKey () const
bool | HashesRequired () const override
virtual bool | AcquireByHash () const
| pkgAcqTransactionItem (pkgAcquire *const Owner, pkgAcqMetaClearSig *const TransactionManager, IndexTarget const &Target) APT_NONNULL(2
Public Member Functions inherited from pkgAcquire::Item
virtual void | Failed (std::string const &Message, pkgAcquire::MethodConfig const *const Cnf)
| Invoked by the acquire worker when the object couldn't be fetched.
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 | Done (std::string const &Message, HashStringList const &Hashes, pkgAcquire::MethodConfig const *const Cnf)
| Invoked by the acquire worker when the object was fetched successfully.
virtual void | Start (std::string const &Message, unsigned long long const Size)
| Invoked when the worker starts to fetch this object.
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)
virtual std::string | ShortDesc () const
| Short item description.
APT_HIDDEN void | Cancelled ()
| Invoked by the worker when the download is cancelled before completion.
virtual void | Finished ()
| Invoked by the worker when the download is completely done.
std::string | HashSum () const
pkgAcquire * | GetOwner () const
pkgAcquire::ItemDesc & | GetItemDesc ()
virtual bool | IsTrusted () const
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 ()

## Public Attributes

bool | IMSHit
TransactionStates | State
std::string | BaseURI
Public Attributes inherited from pkgAcqTransactionItem
IndexTarget const | Target
std::string | PartialFile
| storge name until a transaction is finished
pkgAcqMetaClearSig *const | TransactionManager
| TransactionManager.
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 Member Functions

bool | CheckDownloadDone (pkgAcqTransactionItem *const I, const std::string &Message, HashStringList const &Hashes) const
| Called when a file is finished being retrieved.
void | QueueForSignatureVerify (pkgAcqTransactionItem *const I, std::string const &File, std::string const &Signature)
| Queue the downloaded Signature for verification.
std::string | Custom600Headers () const override
| Custom headers to be sent to the fetch process.
bool | CheckAuthDone (std::string const &Message, pkgAcquire::MethodConfig const *const Cnf)
| Called when authentication succeeded.
bool | CheckStopAuthentication (pkgAcquire::Item *const I, const std::string &Message)
bool | VerifyVendor (std::string const &Message)
| Check that the release file is a release file for the correct distribution.
bool | TransactionState (TransactionStates state) override
Protected Member Functions inherited from pkgAcqTransactionItem
HashStringList | GetExpectedHashesFor (std::string const &MetaKey) const
bool | QueueURI (pkgAcquire::ItemDesc &Item) override
| Insert this item into its owner's queue.
Protected Member Functions inherited from pkgAcquire::Item
bool | RenameOnError (RenameOnErrorState const state)
| Rename failed file and set error.
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

std::vector< pkgAcqTransactionItem * > | Transaction
bool | AuthPass
| If true, the index's signature is currently being verified.
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 pkgAcqTransactionItem
enum | TransactionStates { TransactionStarted , TransactionCommit , TransactionAbort }
Public Types inherited from pkgAcquire::Item
enum | ItemState { StatIdle , StatFetching , StatDone , StatError , StatAuthError , StatTransientNetworkError }
| The current status of this item. More...
Protected Types inherited from pkgAcquire::Item
enum | RenameOnErrorState { HashSumMismatch , SizeMismatch , InvalidFormat , SignatureError , NotClearsigned , MaximumSizeExceeded , PDiffError }

## Detailed Description

the manager of a transaction

## Member Function Documentation

## CheckAuthDone()

bool CheckAuthDone | ( | std::string const & | Message,
|  | pkgAcquire::MethodConfig const *const | Cnf )

protected

Called when authentication succeeded.

Sanity-checks the authenticated file, queues up the individual index files for download, and saves the signature in the lists directory next to the authenticated list file.

Parameters

  Message | The message block received from the fetch subprocess.
  Cnf | The method and its configuration which handled the request

References pkgAcquire::Item::DestFile, pkgAcquire::Item::ErrorText, GetFinalFilename(), pkgAcquire::Item::StatAuthError, pkgAcqTransactionItem::TransactionManager, VerifyVendor(), and pkgAcquire::MethodConfig::Version.

Referenced by pkgAcqMetaClearSig::Done().

## CheckDownloadDone()

bool CheckDownloadDone | ( | pkgAcqTransactionItem *const | I,
|  | const std::string & | Message,
|  | HashStringList const & | Hashes ) const

protected

Called when a file is finished being retrieved.

If the file was not downloaded to DestFile, a copy process is set up to copy it to DestFile; otherwise, Complete is set to true and the file is moved to its final location.

Parameters

  Message | The message block received from the fetch subprocess.

References pkgAcqTransactionItem::TransactionManager.

Referenced by pkgAcqMetaClearSig::Done(), and pkgAcqMetaIndex::Done().

## CheckStopAuthentication()

bool CheckStopAuthentication | ( | pkgAcquire::Item *const | I,
|  | const std::string & | Message )

protected

Check if the current item should fail at this point

References pkgAcquire::Item::Desc, pkgAcquire::Item::StatAuthError, and pkgAcquire::Item::StatTransientNetworkError.

Referenced by pkgAcqMetaClearSig::Failed().

## Custom600Headers()

string Custom600Headers | ( |  | ) | const

nodiscard override protected virtual

Custom headers to be sent to the fetch process.

Returns
  a string containing RFC822-style headers that are to be inserted into the 600 URI Acquire message sent to the fetch subprocess. The headers are inserted after a newline-less line, so they should (if nonempty) have a leading newline and no trailing newline.

Reimplemented from pkgAcquire::Item.

Reimplemented in pkgAcqMetaClearSig.

References pkgAcquire::Item::Custom600Headers(), and GetFinalFilename().

Referenced by pkgAcqMetaClearSig::Custom600Headers().

## GetExpectedHashes()

HashStringList GetExpectedHashes | ( |  | ) | const

nodiscard override virtual

Returns
  HashSums the DestFile is supposed to have in this stage

Implements pkgAcquire::Item.

## GetFinalFilename()

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

nodiscard override virtual

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

Reimplemented from pkgAcquire::Item.

Referenced by CheckAuthDone(), Custom600Headers(), pkgAcqMetaClearSig::Done(), pkgAcqMetaClearSig::Failed(), pkgAcqMetaIndex::Failed(), and VerifyVendor().

## HashesRequired()

APT_PURE bool HashesRequired | ( |  | ) | const

nodiscard override virtual

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.

## QueueURI()

bool QueueURI | ( | pkgAcquire::ItemDesc & | Item | ) |

override virtual

Insert this item into its owner's queue.

The method is designed to check if the request would end in an IMSHit and if it determines that it would, it isn't queueing the Item and instead sets it to completion instantly.

Parameters

  Item | Metadata about this item (its URI and description).

Returns
  true if the item was inserted, false if IMSHit was detected

Reimplemented from pkgAcquire::Item.

References pkgAcquire::Item::Item(), and pkgAcquire::Item::QueueURI().

Referenced by pkgAcqMetaIndex::pkgAcqMetaIndex(), and QueueForSignatureVerify().

## TransactionState()

bool TransactionState | ( | TransactionStates | state | ) |

override protected virtual

Reimplemented from pkgAcqTransactionItem.

## VerifyVendor()

bool VerifyVendor | ( | std::string const & | Message | ) |

protected

Check that the release file is a release file for the correct distribution.

Returns
  true if no fatal errors were encountered.

References pkgAcquire::Item::Desc, pkgAcquire::Item::DestFile, pkgAcquire::Item::ErrorText, GetFinalFilename(), pkgAcquire::Item::Owner, pkgAcqTransactionItem::PartialFile, and pkgAcqTransactionItem::TransactionManager.

Referenced by CheckAuthDone(), and pkgAcqMetaClearSig::Failed().

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

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