apt: pkgAcqIndexMergeDiffs Class Reference

apt 3.1.4 commandline package manager

Public Member Functions | Protected Types | Protected Attributes | List of all members
pkgAcqIndexMergeDiffs Class Referencefinal
Acquire system {{{

An item that is responsible for fetching client-merge patches {{{ that need to be applied to a given package index file. More...

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

Inheritance diagram for pkgAcqIndexMergeDiffs:

## Public Member Functions
void | Failed (std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override
| Called when the patch file failed to be downloaded.
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 | Custom600Headers () const override
| Custom headers to be sent to the fetch process.
std::string | DescURI () const override
| A "descriptive" URI-like string.
HashStringList | GetExpectedHashes () const override
bool | HashesRequired () const override
bool | AcquireByHash () const override
| pkgAcqIndexMergeDiffs (pkgAcquire *const Owner, pkgAcqMetaClearSig *const TransactionManager, IndexTarget const &Target, DiffInfo const &patch, std::vector< pkgAcqIndexMergeDiffs * > const *const allPatches) APT_NONNULL(2
| Create an index merge-diff item.
Public Member Functions inherited from pkgAcqBaseIndex
std::string | GetFinalFilename () const override
| Get the full pathname of the final file for the current URI.
| pkgAcqBaseIndex (pkgAcquire *const Owner, pkgAcqMetaClearSig *const TransactionManager, IndexTarget const &Target) APT_NONNULL(2
Public Member Functions inherited from pkgAcqTransactionItem
virtual bool | TransactionState (TransactionStates const state)
std::string | DescURI () const override
| A "descriptive" URI-like string.
HashStringList | GetExpectedHashes () const override
virtual std::string | GetMetaKey () const
bool | HashesRequired () const override
| pkgAcqTransactionItem (pkgAcquire *const Owner, pkgAcqMetaClearSig *const TransactionManager, IndexTarget const &Target) APT_NONNULL(2
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.
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.
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 ()

## Protected Types
enum | DiffState { StateFetchDiff , StateApplyDiff , StateDoneDiff , StateErrorDiff }
Protected Types inherited from pkgAcquire::Item
enum | RenameOnErrorState { HashSumMismatch , SizeMismatch , InvalidFormat , SignatureError , NotClearsigned , MaximumSizeExceeded , PDiffError }

## Protected Attributes
bool | Debug
| If true, debugging output will be written to std::clog.
struct DiffInfo const | patch
| information about the current patch
std::vector< pkgAcqIndexMergeDiffs * > const *const | allPatches
| list of all download items for the patches
enum pkgAcqIndexMergeDiffs::DiffState | State
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...
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 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.

## Detailed Description

An item that is responsible for fetching client-merge patches {{{ that need to be applied to a given package index file.

Instead of downloading and applying each patch one by one like its sister pkgAcqIndexDiffs this class will download all patches at once and call rred with all the patches downloaded once. Rred will then merge and apply them in one go, which should be a lot faster – but is incompatible with server-based merges of patches like reprepro can do.

See also
  pkgAcqDiffIndex, pkgAcqIndex

## Member Enumeration Documentation

## ◆ DiffState

enum DiffState
| protected

The current status of this patch.

Enumerator
StateFetchDiff | The diff is currently being fetched.
StateApplyDiff | The diff is currently being applied.
StateDoneDiff | the work with this diff is done
StateErrorDiff | something bad happened and fallback was triggered

## Constructor & Destructor Documentation

## ◆ pkgAcqIndexMergeDiffs()

pkgAcqIndexMergeDiffs | ( | pkgAcquire *const | Owner,
|  | pkgAcqMetaClearSig *const | TransactionManager,
|  | IndexTarget const & | Target,
|  | DiffInfo const & | patch,
|  | std::vector< pkgAcqIndexMergeDiffs * > const *const | allPatches )

Create an index merge-diff item.

Parameters

  Owner | The pkgAcquire object that owns this item.
  TransactionManager | responsible for this item
  Target | we intend to built via pdiff patching
  baseURI | is the URI used for the Index, but stripped down to Target
  DiffInfo | of the patch in question
  patch | contains infos about the patch this item is supposed to download which were read from the index
  allPatches | contains all related items so that each item can check if it was the last one to complete the download step

References allPatches, Debug, pkgAcquire::Item::Desc, pkgAcquire::Item::DestFile, pkgAcquire::Item::Owner, patch, pkgAcqTransactionItem::QueueURI(), StateFetchDiff, and pkgAcqTransactionItem::TransactionManager.

Referenced by Done().

## Member Function Documentation

## ◆ AcquireByHash()

bool AcquireByHash | ( |  | ) | const
| nodiscardoverridevirtual

Reimplemented from pkgAcqTransactionItem.

## ◆ Custom600Headers()

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

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.

References allPatches, HashStringList::begin(), pkgAcquire::Item::Custom600Headers(), HashStringList::end(), patch, and StateApplyDiff.

## ◆ DescURI()

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

A "descriptive" URI-like string.

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

Implements pkgAcquire::Item.

## ◆ 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 allPatches, pkgAcquire::Item::Complete, Debug, pkgAcquire::Item::Desc, pkgAcquire::Item::DestFile, pkgAcqBaseIndex::GetFinalFilename(), pkgAcquire::Item::Local, patch, pkgAcqIndexMergeDiffs(), pkgAcqTransactionItem::QueueURI(), pkgAcquire::Item::Rename(), pkgAcquire::Item::SetActiveSubprocess(), StateApplyDiff, StateDoneDiff, StateErrorDiff, StateFetchDiff, and pkgAcqTransactionItem::TransactionManager.

## ◆ Failed()

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

Called when the patch file failed to be downloaded.

This method will fall back to downloading the whole index file outright; its arguments are ignored.

Reimplemented from pkgAcqBaseIndex.

References allPatches, Debug, pkgAcquire::Item::Desc, pkgAcquire::Item::DestFile, pkgAcqBaseIndex::Failed(), pkgAcquire::Item::Owner, pkgAcquire::Item::Rename(), pkgAcquire::Item::RenameOnError(), pkgAcquire::Item::StatDone, StateDoneDiff, StateErrorDiff, and pkgAcqTransactionItem::TransactionManager.

## ◆ GetExpectedHashes()

HashStringList GetExpectedHashes | ( |  | ) | const
| nodiscardoverridevirtual

Returns
  HashSums the DestFile is supposed to have in this stage

Implements pkgAcquire::Item.

References patch, StateApplyDiff, and StateFetchDiff.

## ◆ 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.

References StateApplyDiff, and StateFetchDiff.

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

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