apt  2.2.4
About: Apt (Advanced Package Tool) is a management system for software packages (Debian/Ubuntu). Release series 2.2.
  Fossies Dox: apt-2.2.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

pkgAcquire Struct Referenceabstract

Represents the process by which a pkgAcquire object should retrieve a file or a collection of files. More...

#include <acquire-item.h>

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

Classes

struct  QItem
 A single item placed in this queue. More...
 

Public Types

enum  ItemState {
  StatIdle , StatFetching , StatDone , StatError ,
  StatAuthError , StatTransientNetworkError
}
 The current status of this item. More...
 
enum  RunResult { Continue , Failed , Cancelled }
 Provides information on how a download terminated. More...
 
typedef std::vector< Item * >::iterator ItemIterator
 
typedef std::vector< Item * >::const_iterator ItemCIterator
 

Public Member Functions

virtual void Failed (std::string const &Message, pkgAcquire::MethodConfig const *const Cnf)
 Invoked by the acquire worker when the object couldn't be fetched. More...
 
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. More...
 
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. More...
 
virtual void Start (std::string const &Message, unsigned long long const Size)
 Invoked when the worker starts to fetch this object. More...
 
virtual std::string Custom600Headers () const
 Custom headers to be sent to the fetch process. More...
 
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 &&OldSite)
 
virtual std::string DescURI () const =0
 A "descriptive" URI-like string. More...
 
virtual std::string ShortDesc () const
 Short item description. More...
 
virtual void Finished ()
 Invoked by the worker when the download is completely done. More...
 
virtual HashStringList GetExpectedHashes () const =0
 
std::string HashSum () const
 
virtual bool HashesRequired () const
 
pkgAcquireGetOwner () const
 
pkgAcquire::ItemDesc & GetItemDesc ()
 
virtual bool IsTrusted () const
 
void SetActiveSubprocess (std::string const &subprocess)
 Set the name of the current active subprocess. More...
 
 Item (pkgAcquire *const Owner)
 Initialize an item. More...
 
virtual ~Item ()
 Remove this item from its owner's queue by invoking pkgAcquire::Remove. More...
 
bool APT_HIDDEN IsRedirectionLoop (std::string const &NewURI)
 
int APT_HIDDEN Priority ()
 The priority of the item, used for queuing. More...
 
bool QueueItem (pkgAcquire::Queue::QItem *Item)
 Tell the subprocess to download the given item. More...
 
APT_HIDDEN bool ReplyAux (pkgAcquire::ItemDesc const &Item)
 
bool Start ()
 Start up the worker and fill in Config. More...
 
void Pulse ()
 Update the worker statistics (CurrentSize, TotalSize, etc). More...
 
const MethodConfigGetConf () const
 
 Worker (Queue *OwnerQ, MethodConfig *Config, pkgAcquireStatus *Log)
 Create a new Worker to download files. More...
 
 Worker (MethodConfig *Config)
 Create a new Worker that should just retrieve information about the fetch method. More...
 
virtual ~Worker ()
 Clean up this worker. More...
 
MethodConfigGetConfig (std::string Access)
 Retrieve information about a fetch method by name. More...
 
RunResult Run (int PulseInterval=500000)
 Download all the items that have been Add()ed to this download process. More...
 
void Shutdown ()
 Remove all items from this download process, terminate all download workers, and empty all queues. More...
 
WorkerWorkersBegin ()
 Get the first Worker object. More...
 
WorkerWorkerStep (Worker *I) APT_PURE
 Advance to the next Worker object. More...
 
ItemIterator ItemsBegin ()
 Get the head of the list of items. More...
 
ItemCIterator ItemsBegin () const
 
ItemIterator ItemsEnd ()
 Get the end iterator of the list of items. More...
 
ItemCIterator ItemsEnd () const
 
UriIterator UriBegin ()
 Get the head of the list of enqueued item URIs. More...
 
UriIterator UriEnd ()
 Get the end iterator of the list of enqueued item URIs. More...
 
bool Clean (std::string Dir)
 
unsigned long long TotalNeeded ()
 
unsigned long long FetchNeeded ()
 
unsigned long long PartialPresent ()
 
void SetLog (pkgAcquireStatus *Progress)
 
bool GetLock (std::string const &Lock)
 acquire lock and perform directory setup More...
 
 pkgAcquire (pkgAcquireStatus *Log)
 Construct a new pkgAcquire. More...
 
 pkgAcquire ()
 
virtual ~pkgAcquire ()
 Destroy this pkgAcquire object. More...
 
bool Enqueue (ItemDesc &Item)
 Insert the given fetch request into this queue. More...
 
bool Dequeue (Item *Owner)
 Remove all fetch requests for the given item from this queue. More...
 
QItemFindItem (std::string URI, pkgAcquire::Worker *Owner) APT_PURE
 Locate an item in this queue. More...
 
bool ItemStart (QItem *Itm, unsigned long long Size)
 
bool ItemDone (QItem *Itm)
 Remove the given item from this queue and set its state to pkgAcquire::Item::StatDone. More...
 
bool Startup ()
 Start the worker process associated with this queue. More...
 
bool Shutdown (bool Final)
 Shut down the worker process associated with this queue. More...
 
bool Cycle ()
 Send idle items to the worker process. More...
 
void Bump ()
 Check for items that could be enqueued. More...
 
 Queue (std::string const &Name, pkgAcquire *const Owner)
 Create a new Queue. More...
 
virtual ~Queue ()
 
void operator++ ()
 
void operator++ (int)
 
pkgAcquire::Queue::QItem const * operator-> () const
 
bool operator!= (UriIterator const &rhs) const
 
bool operator== (UriIterator const &rhs) const
 
 UriIterator (pkgAcquire::Queue *Q)
 Create a new UriIterator. More...
 
virtual ~UriIterator ()
 
 MethodConfig ()
 Set up the default method parameters. More...
 
APT_HIDDEN bool GetAuxRequests () const
 
APT_HIDDEN void SetAuxRequests (bool const value)
 
APT_HIDDEN bool GetSendURIEncoded () const
 
APT_HIDDEN void SetSendURIEncoded (bool const value)
 
virtual ~MethodConfig ()
 

Static Public Member Functions

static APT_HIDDEN std::string URIEncode (std::string const &part)
 

Public Attributes

enum pkgAcquire::ItemState Status
 
std::string ErrorText
 Contains a textual description of the error encountered if ItemState is StatError or StatAuthError. More...
 
unsigned long long FileSize
 The size of the object to fetch. More...
 
unsigned long long PartialSize
 How much of the object was already fetched. More...
 
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. More...
 
unsigned long ID
 A client-supplied unique identifier. More...
 
bool Complete
 If true, the entire object has been successfully fetched. More...
 
bool Local
 If true, the URI of this object is "local". More...
 
std::string UsedMirror
 
unsigned int QueueCounter
 The number of fetch queues into which this item has been inserted. More...
 
unsigned int ExpectedAdditionalItems
 The number of additional fetch items that are expected once this item is done. More...
 
std::string DestFile
 The name of the file into which the retrieved object will be written. More...
 
unsigned int Retries
 Number of retries. More...
 
pkgAcquire::Queue::QItem * CurrentItem
 The queue entry that is currently being downloaded. More...
 
std::string Status
 The most recent status string received from the subprocess. More...
 
std::string URI
 URI from which to download this item. More...
 
std::string Description
 description of this item. More...
 
std::string ShortDesc
 shorter description of this item. More...
 
ItemOwner
 underlying item which is to be downloaded. More...
 
MethodConfigNext
 The next link on the acquire method list. More...
 
std::string Version
 The implementation version of this acquire method. More...
 
bool SingleInstance
 If true, only one download queue should be created for this method. More...
 
bool Pipeline
 If true, this method supports pipelined downloading. More...
 
bool SendConfig
 If true, the worker process should send the entire APT configuration tree to the fetch subprocess when it starts up. More...
 
bool LocalOnly
 If true, this fetch method does not require network access; all files are to be acquired from the local disk. More...
 
bool NeedsCleanup
 If true, the subprocess has to carry out some cleanup actions before shutting down. More...
 
bool Removable
 If true, this fetch method acquires files from removable media. More...
 

Protected Types

enum  RenameOnErrorState {
  HashSumMismatch , SizeMismatch , InvalidFormat , SignatureError ,
  NotClearsigned , MaximumSizeExceeded , PDiffError
}
 
enum  QueueStrategy { QueueHost , QueueAccess }
 Represents the queuing strategy for remote URIs. More...
 

Protected Member Functions

bool RenameOnError (RenameOnErrorState const state)
 Rename failed file and set error. More...
 
virtual bool QueueURI (ItemDesc &Item)
 Insert this item into its owner's queue. More...
 
void Dequeue ()
 Remove this item from its owner's queue. More...
 
bool Rename (std::string const &From, std::string const &To)
 Rename a file without modifying its timestamp. More...
 
virtual std::string GetFinalFilename () const
 Get the full pathname of the final file for the current URI. More...
 
void Construct ()
 Common code for the constructor. More...
 
bool ReadMessages ()
 Retrieve any available messages from the subprocess. More...
 
bool RunMessages ()
 Parse and dispatch pending messages. More...
 
bool InFdReady ()
 Read and dispatch any pending messages from the subprocess. More...
 
bool OutFdReady ()
 Send any pending commands to the subprocess. More...
 
bool Capabilities (std::string Message)
 Handle a 100 Capabilities response from the subprocess. More...
 
bool SendConfiguration ()
 Send a 601 Configuration message (containing the APT configuration) to the subprocess. More...
 
bool MediaChange (std::string Message)
 Handle a 403 Media Change message. More...
 
bool MethodFailure ()
 Invoked when the worked process dies unexpectedly. More...
 
void ItemDone ()
 Invoked when a fetch job is completed, either successfully or unsuccessfully. More...
 
void Add (Item *Item)
 Add the given item to the list of items. More...
 
void Remove (Item *Item)
 Remove the given item from the list of items. More...
 
void Add (Worker *Work)
 Add the given worker to the list of workers. More...
 
void Remove (Worker *Work)
 Remove the given worker from the list of workers. More...
 
void Enqueue (ItemDesc &Item)
 Insert the given fetch request into the appropriate queue. More...
 
void Dequeue (Item *Item)
 Remove all fetch requests for this item from all queues. More...
 
std::string QueueName (std::string URI, MethodConfig const *&Config)
 Determine the fetch method and queue of a URI. More...
 
virtual void SetFds (int &Fd, fd_set *RSet, fd_set *WSet)
 Build up the set of file descriptors upon which select() should block. More...
 
virtual bool RunFds (fd_set *RSet, fd_set *WSet)
 
void Bump ()
 Check for idle queues with ready-to-fetch items. More...
 

Protected Attributes

pkgAcquire *const Owner
 The acquire object with which this item is associated. More...
 
pkgAcquire::ItemDesc Desc
 The item that is currently being downloaded. More...
 
WorkerNextQueue
 The next link on the Queue list. More...
 
WorkerNextAcquire
 The next link on the Acquire list. More...
 
QueueOwnerQ
 The Queue with which this worker is associated. More...
 
pkgAcquireStatusLog
 The download progress indicator to which progress messages should be sent. More...
 
MethodConfigConfig
 The configuration of this method. On startup, the target of this pointer is filled in with basic data about the method, as reported by the worker. More...
 
std::string Access
 The access method to be used by this worker. More...
 
pid_t Process
 The PID of the subprocess. More...
 
int InFd
 A file descriptor connected to the standard output of the subprocess. More...
 
int OutFd
 A file descriptor connected to the standard input of the subprocess. More...
 
int PrivSepSocketFd
 The socket to send SCM_RIGHTS message through. More...
 
int PrivSepSocketFdChild
 
bool InReady
 Set to true if the worker is in a state in which it might generate data or command responses. More...
 
bool OutReady
 Set to true if the worker is in a state in which it is legal to send commands to it. More...
 
bool Debug
 
std::vector< std::string > MessageQueue
 The raw text values of messages received from the worker, in sequence. More...
 
std::string OutQueue
 Buffers pending writes to the subprocess. More...
 
std::vector< Item * > Items
 A list of items to download. More...
 
QueueQueues
 The head of the list of active queues. More...
 
WorkerWorkers
 The head of the list of active workers. More...
 
MethodConfigConfigs
 The head of the list of acquire method configurations. More...
 
unsigned long ToFetch
 The number of files which are to be fetched. More...
 
enum pkgAcquire::QueueStrategy QueueMode
 
bool const Debug
 If true, debugging information will be dumped to std::clog. More...
 
bool Running
 If true, a download is currently in progress. More...
 
std::string Name
 The name of this queue. More...
 
QItemItems
 The head of the list of items contained in this queue. More...
 
pkgAcquire::WorkerWorkers
 The head of the list of workers associated with this queue. More...
 
pkgAcquireOwner
 the download scheduler with which this queue is associated. More...
 
signed long PipeDepth
 The number of entries in this queue that are currently being downloaded. More...
 
unsigned long MaxPipeDepth
 The maximum number of entries that this queue will attempt to download at once. More...
 

Private Member Functions

APT_HIDDEN void PrepareFiles (char const *const caller, pkgAcquire::Queue::QItem const *const Itm)
 
APT_HIDDEN void HandleFailure (std::vector< pkgAcquire::Item * > const &ItmOwners, pkgAcquire::MethodConfig *const Config, pkgAcquireStatus *const Log, std::string const &Message, bool const errTransient, bool const errAuthErr)
 
APT_HIDDEN void Initialize ()
 

Private Attributes

Private *const d
 dpointer placeholder (for later in case we need it) More...
 
void *const d
 dpointer placeholder (for later in case we need it) More...
 
int LockFD
 FD of the Lock file we acquire in Setup (if any) More...
 
QueueNext
 The next queue in the pkgAcquire object's list of queues. More...
 
pkgAcquire::QueueCurQ
 
pkgAcquire::Queue::QItem * CurItem
 

Friends

class pkgAcqMetaBase
 
class pkgAcqMetaClearSig
 
class pkgAcquire
 
class Queue
 
class Item
 
class pkgAcquire::UriIterator
 
class pkgAcquire::Worker
 

Detailed Description

Represents the process by which a pkgAcquire object should retrieve a file or a collection of files.

Information about the properties of a single acquire method. {{{.

Iterates over all the URIs being fetched by a pkgAcquire object. {{{.

A single download queue in a pkgAcquire object. {{{.

Represents a single download source from which an item should be downloaded.

The core download scheduler. {{{.

A fetch subprocess.

By convention, Item subclasses should insert themselves into the acquire queue when they are created by calling QueueURI(), and remove themselves by calling Dequeue() when either Done() or Failed() is invoked. Item objects are also responsible for notifying the download progress indicator (accessible via Owner->Log) of their status.

See also
pkgAcquire

A worker process is responsible for one stage of the fetch. This class encapsulates the communications protocol between the master process and the worker, from the master end.

Each worker is intrinsically placed on two linked lists. The Queue list (maintained in the NextQueue variable) is maintained by the pkgAcquire::Queue class; it represents the set of workers assigned to a particular queue. The Acquire list (maintained in the NextAcquire variable) is maintained by the pkgAcquire class; it represents the set of active workers for a particular pkgAcquire object.

Todo:
Like everything else in the Acquire system, this has way too many protected items.
See also
pkgAcqMethod, pkgAcquire::Item, pkgAcquire

This class represents an ongoing download. It manages the lists of active and pending downloads and handles setting up and tearing down download-related structures.

Todo:
Why all the protected data items and methods?

An item may have several associated ItemDescs over its lifetime.

Todo:
Why so many protected values?

Definition at line 46 of file acquire-item.h.

Member Typedef Documentation

◆ ItemCIterator

typedef std::vector<Item *>::const_iterator ItemCIterator

Definition at line 112 of file acquire.h.

◆ ItemIterator

typedef std::vector<Item *>::iterator ItemIterator

Definition at line 111 of file acquire.h.

Member Enumeration Documentation

◆ ItemState

enum ItemState

The current status of this item.

Enumerator
StatIdle 

The item is waiting to be downloaded.

StatFetching 

The item is currently being downloaded.

StatDone 

The item has been successfully downloaded.

StatError 

An error was encountered while downloading this item.

StatAuthError 

The item was downloaded but its authenticity could not be verified.

StatTransientNetworkError 

The item was could not be downloaded because of a transient network error (e.g. network down)

Definition at line 63 of file acquire-item.h.

◆ QueueStrategy

enum QueueStrategy
protected

Represents the queuing strategy for remote URIs.

Enumerator
QueueHost 

Generate one queue for each protocol/host combination; downloads from multiple hosts can proceed in parallel.

QueueAccess 

Generate a single queue for each protocol; serialize downloads from multiple hosts.

Definition at line 158 of file acquire.h.

◆ RenameOnErrorState

enum RenameOnErrorState
protected
Enumerator
HashSumMismatch 
SizeMismatch 
InvalidFormat 
SignatureError 
NotClearsigned 
MaximumSizeExceeded 
PDiffError 

Definition at line 311 of file acquire-item.h.

◆ RunResult

enum RunResult

Provides information on how a download terminated.

Enumerator
Continue 

All files were fetched successfully.

Failed 

Some files failed to download.

Cancelled 

The download was cancelled by the user (i.e., Log's pkgAcquireStatus::Pulse() method returned false).

Definition at line 257 of file acquire.h.

Constructor & Destructor Documentation

◆ ~Item()

virtual ~Item ( )
virtual

Remove this item from its owner's queue by invoking pkgAcquire::Remove.

◆ ~Worker()

virtual ~Worker ( )
virtual

Clean up this worker.

Closes the file descriptors; if MethodConfig::NeedsCleanup is false, also rudely interrupts the worker with a SIGINT.

◆ pkgAcquire() [1/2]

pkgAcquire ( pkgAcquireStatus Log)
explicit

Construct a new pkgAcquire.

Definition at line 69 of file acquire.cc.

References Initialize(), and SetLog().

◆ pkgAcquire() [2/2]

◆ ~pkgAcquire()

~pkgAcquire ( )
virtual

Destroy this pkgAcquire object.

Destroys all queue, method, and item objects associated with this download.

Definition at line 179 of file acquire.cc.

References Configs, LockFD, MethodConfig(), and Shutdown().

◆ ~Queue()

virtual ~Queue ( )
virtual

Shut down all the worker processes associated with this queue and empty the queue.

◆ ~UriIterator()

virtual ~UriIterator ( )
virtual

◆ ~MethodConfig()

virtual ~MethodConfig ( )
virtual

Member Function Documentation

◆ Add() [1/2]

void Add ( Item Item)
protected

Add the given item to the list of items.

Definition at line 218 of file acquire.cc.

References Items.

◆ Add() [2/2]

void Add ( Worker Work)
protected

Add the given worker to the list of workers.

Definition at line 246 of file acquire.cc.

References Workers.

◆ Bump() [1/2]

void Bump ( )
protected

Check for idle queues with ready-to-fetch items.

Called by pkgAcquire::Queue::Done each time an item is dequeued but remains on some queues; i.e., another queue should start fetching it.

Definition at line 772 of file acquire.cc.

References I, Queue, and Queues.

◆ Bump() [2/2]

void Bump ( )

Check for items that could be enqueued.

Call this after an item placed in multiple queues has gone from the pkgAcquire::Item::StatFetching state to the pkgAcquire::Item::StatIdle state, to possibly refill an empty queue. This is an alias for Cycle().

Todo:
Why both this and Cycle()? Are they expected to be different someday?

◆ Capabilities()

bool Capabilities ( std::string  Message)
protected

Handle a 100 Capabilities response from the subprocess.

Parameters
Messagethe raw text of the message from the subprocess.

The message will be parsed and its contents used to fill Config. If Config is NULL, this routine is a NOP.

Returns
true.

◆ Clean()

bool Clean ( std::string  Dir)

Deletes each entry in the given directory that is not being downloaded by this object. For instance, when downloading new list files, calling Clean() will delete the old ones.

Parameters
DirThe directory to be cleaned out.
Returns
true if the directory exists and is readable.

Definition at line 790 of file acquire.cc.

References DIR, DirectoryExists(), I, Item, Items, and RemoveFileAt().

Referenced by AcquireUpdate(), and DoClean().

◆ Construct()

void Construct ( )
protected

Common code for the constructor.

Initializes NextQueue and NextAcquire to NULL; Process, InFd, and OutFd to -1, OutReady and InReady to false, and Debug from _config.

◆ Custom600Headers()

virtual std::string Custom600Headers ( ) const
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.

◆ Cycle()

bool Cycle ( )

Send idle items to the worker process.

Fills up the pipeline by inserting idle items into the worker's queue.

◆ Dequeue() [1/3]

void Dequeue ( )
protected

Remove this item from its owner's queue.

Referenced by Remove().

◆ Dequeue() [2/3]

void Dequeue ( Item Item)
protected

Remove all fetch requests for this item from all queues.

Definition at line 366 of file acquire.cc.

References Debug, I, Queue, Queues, and ToFetch.

◆ Dequeue() [3/3]

bool Dequeue ( Item Owner)

Remove all fetch requests for the given item from this queue.

Returns
true if at least one request was removed from the queue.

◆ DescURI()

virtual std::string DescURI ( ) const
pure virtual

A "descriptive" URI-like string.

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

◆ Done()

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

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
MessageData from the acquire method. Use LookupTag() to parse it.
HashesThe HashSums of the object that was fetched.
CnfThe method via which the object was fetched.
See also
pkgAcqMethod

◆ Enqueue() [1/2]

void Enqueue ( ItemDesc &  Item)
protected

Insert the given fetch request into the appropriate queue.

Parameters
ItemThe URI to download and the item to download it for. Copied by value into the queue; no reference to Item is retained.

Definition at line 313 of file acquire.cc.

References CheckForBadItemAndFailIt(), Config, Debug, I, Item, Log, MethodConfig(), Name, Queue, QueueName(), Queues, Running, and ToFetch.

◆ Enqueue() [2/2]

bool Enqueue ( ItemDesc &  Item)

Insert the given fetch request into this queue.

Returns
true if the queuing was successful. May return false if the Item is already in the queue

◆ Failed()

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

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

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

Parameters
MessageAn RFC822-formatted message from the acquire method describing what went wrong. Use LookupTag() to parse it.
CnfThe method via which the worker tried to fetch this object.
See also
pkgAcqMethod

◆ FailMessage()

APT_HIDDEN void FailMessage ( std::string const &  Message)

◆ FetchNeeded()

APT_PURE unsigned long long FetchNeeded ( )
Returns
the size in bytes of all non-local items included in this download.

Definition at line 844 of file acquire.cc.

References I, Item, ItemsBegin(), and ItemsEnd().

Referenced by DoSource(), and InstallPackages().

◆ FindItem()

QItem* FindItem ( std::string  URI,
pkgAcquire::Worker Owner 
)

Locate an item in this queue.

Parameters
URIA URI to match against.
OwnerA pkgAcquire::Worker to match against.
Returns
the first item in the queue whose URI is URI and that is being downloaded by Owner.

◆ Finished()

virtual void Finished ( )
virtual

Invoked by the worker when the download is completely done.

◆ GetAuxRequests()

APT_HIDDEN bool GetAuxRequests ( ) const

◆ GetConf()

const MethodConfig* GetConf ( ) const
inline
Returns
The fetch method configuration.

Definition at line 281 of file acquire-worker.h.

◆ GetConfig()

pkgAcquire::MethodConfig * GetConfig ( std::string  Access)

Retrieve information about a fetch method by name.

Parameters
AccessThe name of the method to look up.
Returns
the method whose name is Access, or NULL if no such method exists.

Definition at line 494 of file acquire.cc.

References _config, Access, Configs, MethodConfig(), and Worker().

Referenced by QueueName().

◆ GetExpectedHashes()

virtual HashStringList GetExpectedHashes ( ) const
pure virtual
Returns
HashSums the DestFile is supposed to have in this stage

◆ GetFinalFilename()

virtual std::string GetFinalFilename ( ) const
protectedvirtual

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

◆ GetItemDesc()

pkgAcquire::ItemDesc& GetItemDesc ( )

◆ GetLock()

bool GetLock ( std::string const &  Lock)

acquire lock and perform directory setup

Parameters
Lockdefines a lock file that should be acquired to ensure only one Acquire class is in action at the time or an empty string if no lock file should be used. If set also all needed directories will be created and setup.

Definition at line 136 of file acquire.cc.

References _config, flCombine(), LockFD, and SetupAPTPartialDirectory().

Referenced by DoClean(), InstallPackages(), and ListUpdate().

◆ GetOwner()

pkgAcquire* GetOwner ( ) const
Returns
the acquire process with which this item is associated.

◆ GetSendURIEncoded()

APT_HIDDEN bool GetSendURIEncoded ( ) const

◆ HandleFailure()

APT_HIDDEN void HandleFailure ( std::vector< pkgAcquire::Item * > const &  ItmOwners,
pkgAcquire::MethodConfig *const  Config,
pkgAcquireStatus *const  Log,
std::string const &  Message,
bool const  errTransient,
bool const  errAuthErr 
)
private

◆ HashesRequired()

virtual bool HashesRequired ( ) const
inlinevirtual
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.

Definition at line 270 of file acquire-item.h.

◆ HashSum()

std::string HashSum ( ) const
Returns
the 'best' hash for display proposes like –print-uris

◆ InFdReady()

bool InFdReady ( )
protected

Read and dispatch any pending messages from the subprocess.

Returns
false if the subprocess died unexpectedly while a message was being transmitted.

◆ Initialize()

void Initialize ( )
private

Definition at line 77 of file acquire.cc.

References _config, QueueAccess, QueueHost, and QueueMode.

Referenced by pkgAcquire().

◆ IsGoodAlternativeURI()

APT_HIDDEN bool IsGoodAlternativeURI ( std::string const &  AltUri) const

◆ IsRedirectionLoop()

bool APT_HIDDEN IsRedirectionLoop ( std::string const &  NewURI)

◆ IsTrusted()

virtual bool IsTrusted ( ) const
virtual
Returns
true if this object is being fetched from a trusted source.

◆ Item()

Item ( pkgAcquire *const  Owner)
explicit

Initialize an item.

Adds the item to the list of items known to the acquire process, but does not place it into any fetch queues (you must manually invoke QueueURI() to do so).

Parameters
OwnerThe new owner of this item.

◆ ItemDone() [1/2]

void ItemDone ( )
protected

Invoked when a fetch job is completed, either successfully or unsuccessfully.

Resets the status information for the worker process.

◆ ItemDone() [2/2]

bool ItemDone ( QItem Itm)

Remove the given item from this queue and set its state to pkgAcquire::Item::StatDone.

If this is the only queue containing the item, the item is also removed from the main queue by calling pkgAcquire::Dequeue.

Parameters
ItmThe item to remove.
Returns
true if no errors are encountered.

◆ ItemsBegin() [1/2]

◆ ItemsBegin() [2/2]

ItemCIterator ItemsBegin ( ) const
inline

Definition at line 302 of file acquire.h.

◆ ItemsEnd() [1/2]

◆ ItemsEnd() [2/2]

ItemCIterator ItemsEnd ( ) const
inline

Definition at line 306 of file acquire.h.

◆ ItemStart()

bool ItemStart ( QItem Itm,
unsigned long long  Size 
)

Presumably this should start downloading an item?

Todo:
Unimplemented. Implement it or remove?

◆ MediaChange()

bool MediaChange ( std::string  Message)
protected

Handle a 403 Media Change message.

Parameters
Messagethe raw text of the message; the Media field indicates what type of media should be changed, and the Drive field indicates where the media is located.

Invokes pkgAcquireStatus::MediaChange(Media, Drive) to ask the user to swap disks; informs the subprocess of the result (via 603 Media Changed, with the Failed field set to true if the user cancelled the media change).

◆ MethodConfig()

MethodConfig ( )

Set up the default method parameters.

All fields are initialized to NULL, "", or false as appropriate.

Referenced by Enqueue(), GetConfig(), and ~pkgAcquire().

◆ MethodFailure()

bool MethodFailure ( )
protected

Invoked when the worked process dies unexpectedly.

Waits for the subprocess to terminate and generates an error if it terminated abnormally, then closes and blanks out all file descriptors. Discards all pending messages from the subprocess.

Returns
false.

◆ ModifyCustomFields()

APT_HIDDEN std::unordered_map<std::string, std::string>& ModifyCustomFields ( )

◆ operator!=()

bool operator!= ( UriIterator const &  rhs) const
inline

Definition at line 616 of file acquire.h.

◆ operator++() [1/2]

void operator++ ( )
inline

Definition at line 603 of file acquire.h.

◆ operator++() [2/2]

void operator++ ( int  )
inline

Definition at line 605 of file acquire.h.

◆ operator->()

pkgAcquire::Queue::QItem const* operator-> ( ) const
inline

Definition at line 615 of file acquire.h.

◆ operator==()

bool operator== ( UriIterator const &  rhs) const
inline

Definition at line 617 of file acquire.h.

◆ OutFdReady()

bool OutFdReady ( )
protected

Send any pending commands to the subprocess.

This method will fail if there is no pending output.

Returns
true if all commands were succeeded, false if an error occurred (in which case MethodFailure() will be invoked).

◆ PartialPresent()

APT_PURE unsigned long long PartialPresent ( )
Returns
the amount of data to be fetched that is already present on the filesystem.

Definition at line 858 of file acquire.cc.

References I, Item, ItemsBegin(), and ItemsEnd().

Referenced by DoSource(), and InstallPackages().

◆ PopAlternativeURI()

APT_HIDDEN bool PopAlternativeURI ( std::string &  NewURI)

◆ PrepareFiles()

APT_HIDDEN void PrepareFiles ( char const *const  caller,
pkgAcquire::Queue::QItem const *const  Itm 
)
private

◆ Priority()

int APT_HIDDEN Priority ( )

The priority of the item, used for queuing.

◆ Pulse()

void Pulse ( )

Update the worker statistics (CurrentSize, TotalSize, etc).

◆ PushAlternativeURI()

APT_HIDDEN void PushAlternativeURI ( std::string &&  NewURI,
std::unordered_map< std::string, std::string > &&  fields,
bool const  at_the_back 
)

◆ Queue()

Queue ( std::string const &  Name,
pkgAcquire *const  Owner 
)

Create a new Queue.

Parameters
NameThe name of the new queue.
OwnerThe download process that owns the new queue.

◆ QueueItem()

bool QueueItem ( pkgAcquire::Queue::QItem *  Item)

Tell the subprocess to download the given item.

Parameters
Itemthe item to queue up.
Returns
true if the item was successfully enqueued.

Queues up a 600 URI Acquire message for the given item to be sent at the next possible moment. Does not flush the output queue.

◆ QueueName()

string QueueName ( std::string  URI,
MethodConfig const *&  Config 
)
protected

Determine the fetch method and queue of a URI.

Parameters
URIThe URI to fetch.
[out]ConfigA location in which to place the method via which the URI is to be fetched.
Returns
the string-name of the queue in which a fetch request for the given URI should be placed.

Definition at line 392 of file acquire.cc.

References _config, URI::Access, Config, FileSize, GetConfig(), URI::Host, I, Queue, QueueAccess, QueueMode, Queues, and APT::String::Startswith().

Referenced by Enqueue().

◆ QueueURI()

virtual bool QueueURI ( ItemDesc &  Item)
protectedvirtual

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
ItemMetadata about this item (its URI and description).
Returns
true if the item was inserted, false if IMSHit was detected

◆ ReadMessages()

bool ReadMessages ( )
protected

Retrieve any available messages from the subprocess.

The messages are retrieved as in ReadMessages(), and MethodFailure() is invoked if an error occurs; in particular, if the pipe to the subprocess dies unexpectedly while a message is being read.

Returns
true if the messages were successfully read, false otherwise.

◆ Remove() [1/2]

void Remove ( Item Item)
protected

Remove the given item from the list of items.

Definition at line 226 of file acquire.cc.

References Dequeue(), I, and Items.

◆ Remove() [2/2]

void Remove ( Worker Work)
protected

Remove the given worker from the list of workers.

Definition at line 257 of file acquire.cc.

References I, Running, Worker(), and Workers.

◆ RemoveAlternativeSite()

APT_HIDDEN void RemoveAlternativeSite ( std::string &&  OldSite)

◆ Rename()

bool Rename ( std::string const &  From,
std::string const &  To 
)
protected

Rename a file without modifying its timestamp.

Many item methods call this as their final action.

Parameters
FromThe file to be renamed.
ToThe new name of From. If To exists it will be overwritten. If From and To are equal nothing happens.

◆ RenameOnError()

bool RenameOnError ( RenameOnErrorState const  state)
protected

Rename failed file and set error.

Parameters
staterespresenting the error we encountered

◆ ReplyAux()

APT_HIDDEN bool ReplyAux ( pkgAcquire::ItemDesc const &  Item)

◆ Run()

pkgAcquire::RunResult Run ( int  PulseInterval = 500000)

Download all the items that have been Add()ed to this download process.

This method will block until the download completes, invoking methods on Log to report on the progress of the download.

Parameters
PulseIntervalThe method pkgAcquireStatus::Pulse will be invoked on Log at intervals of PulseInterval milliseconds.
Returns
the result of the download.

Definition at line 689 of file acquire.cc.

References Cancelled, CheckDropPrivsMustBeDisabled(), Continue, Failed, I, Items, Log, pkgAcquireStatus::Pulse(), Queue, Queues, RunFds(), Running, SetFds(), pkgAcquireStatus::Start(), pkgAcquireStatus::Stop(), ToFetch, pkgAcquireStatus::Update, Worker(), and Workers.

Referenced by AcquireRun(), and AcquireUpdate().

◆ RunFds()

bool RunFds ( fd_set *  RSet,
fd_set *  WSet 
)
protectedvirtual

Handle input from and output to file descriptors which select() has determined are ready. The default implementation dispatches to all active downloads.

Parameters
RSetThe set of file descriptors that are ready for input.
WSetThe set of file descriptors that are ready for output.
Returns
false if there is an error condition on one of the fds

Definition at line 550 of file acquire.cc.

References I, Worker(), and Workers.

Referenced by Run().

◆ RunMessages()

bool RunMessages ( )
protected

Parse and dispatch pending messages.

This dispatches the message in a manner appropriate for its type.

Todo:
Several message types lack separate handlers.
See also
Capabilities(), SendConfiguration(), MediaChange()

◆ SendConfiguration()

bool SendConfiguration ( )
protected

Send a 601 Configuration message (containing the APT configuration) to the subprocess.

The APT configuration will be send to the subprocess in a message of the following form:

601 Configuration
Config-Item: Fully-Qualified-Item=Val
Config-Item: Fully-Qualified-Item=Val
...
Returns
true if the command was successfully sent, false otherwise.

◆ SetActiveSubprocess()

void SetActiveSubprocess ( std::string const &  subprocess)

Set the name of the current active subprocess.

See also ActiveSubprocess

◆ SetAuxRequests()

APT_HIDDEN void SetAuxRequests ( bool const  value)

◆ SetFds()

void SetFds ( int &  Fd,
fd_set *  RSet,
fd_set *  WSet 
)
protectedvirtual

Build up the set of file descriptors upon which select() should block.

The default implementation inserts the file descriptors corresponding to active downloads.

Parameters
[out]FdThe largest file descriptor in the generated sets.
[out]RSetThe set of file descriptors that should be watched for input.
[out]WSetThe set of file descriptors that should be watched for output.

Definition at line 526 of file acquire.cc.

References I, InFd, OutFd, Worker(), and Workers.

Referenced by Run().

◆ SetLog()

void SetLog ( pkgAcquireStatus Progress)
inline

Definition at line 344 of file acquire.h.

Referenced by aptAcquireWithTextStatus::aptAcquireWithTextStatus(), and pkgAcquire().

◆ SetSendURIEncoded()

APT_HIDDEN void SetSendURIEncoded ( bool const  value)

◆ ShortDesc()

virtual std::string ShortDesc ( ) const
virtual

Short item description.

Returns
a brief description of the object being fetched.

◆ Shutdown() [1/2]

void Shutdown ( )

Remove all items from this download process, terminate all download workers, and empty all queues.

Definition at line 197 of file acquire.cc.

References Items, Queue, Queues, and Status.

Referenced by InstallPackages(), and ~pkgAcquire().

◆ Shutdown() [2/2]

bool Shutdown ( bool  Final)

Shut down the worker process associated with this queue.

Parameters
FinalIf true, then the process is stopped unconditionally. Otherwise, it is only stopped if it does not need cleanup as indicated by the pkgAcqMethod::NeedsCleanup member of its configuration.
Returns
true.

◆ Start() [1/2]

bool Start ( )

Start up the worker and fill in Config.

Reads the first message from the worker, which is assumed to be a 100 Capabilities message.

Returns
true if all operations completed successfully.

◆ Start() [2/2]

virtual void Start ( std::string const &  Message,
unsigned long long const  Size 
)
virtual

Invoked when the worker starts to fetch this object.

Parameters
MessageRFC822-formatted data from the worker process. Use LookupTag() to parse it.
HashesThe expected hashes of the object being fetched.
See also
pkgAcqMethod

◆ Startup()

bool Startup ( )

Start the worker process associated with this queue.

If a worker process is already associated with this queue, this is equivalent to calling Cycle().

Returns
true if the startup was successful.

◆ TotalNeeded()

APT_PURE unsigned long long TotalNeeded ( )
Returns
the total size in bytes of all the items included in this download.

Definition at line 833 of file acquire.cc.

References I, Item, ItemsBegin(), and ItemsEnd().

Referenced by DoSource(), and InstallPackages().

◆ UriBegin()

Get the head of the list of enqueued item URIs.

This iterator will step over every element of every active queue.

Definition at line 872 of file acquire.cc.

References Queues, and UriIterator().

Referenced by DoDownload(), DoSource(), DoUpdate(), and InstallPackages().

◆ URIEncode()

◆ UriEnd()

Get the end iterator of the list of enqueued item URIs.

Definition at line 880 of file acquire.cc.

References UriIterator().

Referenced by DoDownload(), DoSource(), DoUpdate(), and InstallPackages().

◆ UriIterator()

UriIterator ( pkgAcquire::Queue Q)
explicit

Create a new UriIterator.

Parameters
QThe queue over which this UriIterator should iterate.

Referenced by DoDownload(), DoSource(), DoUpdate(), InstallPackages(), UriBegin(), and UriEnd().

◆ VerifyDone()

virtual bool VerifyDone ( std::string const &  Message,
pkgAcquire::MethodConfig const *const  Cnf 
)
virtual

Invoked by the acquire worker to check if the successfully fetched object is also the objected we wanted to have.

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.

This is called before Done is called and can prevent it by returning false which will result in Failed being called instead.

You should prefer to use this method over calling Failed() from Done() as this has e.g. the wrong progress reporting.

Parameters
MessageData from the acquire method. Use LookupTag() to parse it.
CnfThe method via which the object was fetched.
See also
pkgAcqMethod

◆ Worker() [1/2]

Worker ( MethodConfig Config)
explicit

Create a new Worker that should just retrieve information about the fetch method.

Nothing in particular forces you to refrain from actually downloading stuff, but the various status callbacks won't be invoked.

Parameters
ConfigA location in which to store information about the fetch method.

◆ Worker() [2/2]

Worker ( Queue OwnerQ,
MethodConfig Config,
pkgAcquireStatus Log 
)

Create a new Worker to download files.

Parameters
OwnerQThe queue into which this worker should be placed.
ConfigA location in which to store information about the fetch method.
LogThe download progress indicator that should be used to report the progress of this worker.

Referenced by GetConfig(), pkgAcquireStatus::Pulse(), AcqTextStatus::Pulse(), Remove(), Run(), RunFds(), and SetFds().

◆ WorkersBegin()

Worker* WorkersBegin ( )
inline

Get the first Worker object.

Returns
the first active worker in this download process.

Definition at line 291 of file acquire.h.

Referenced by pkgAcquireStatus::Pulse(), and AcqTextStatus::Pulse().

◆ WorkerStep()

pkgAcquire::Worker * WorkerStep ( Worker I)

Advance to the next Worker object.

Returns
the worker immediately following I, or NULL if none exists.

Definition at line 781 of file acquire.cc.

References I.

Referenced by pkgAcquireStatus::Pulse(), and AcqTextStatus::Pulse().

Friends And Related Function Documentation

◆ Item

friend class Item
friend

Definition at line 107 of file acquire.h.

Referenced by Clean(), DoDownload(), Enqueue(), FetchNeeded(), PartialPresent(), and TotalNeeded().

◆ pkgAcqMetaBase

Definition at line 360 of file acquire-item.h.

◆ pkgAcqMetaClearSig

friend class pkgAcqMetaClearSig
friend

Definition at line 361 of file acquire-item.h.

◆ pkgAcquire

pkgAcquire
friend

Definition at line 52 of file acquire-worker.h.

◆ pkgAcquire::UriIterator

friend class pkgAcquire::UriIterator
friend

Definition at line 396 of file acquire.h.

◆ pkgAcquire::Worker

friend class pkgAcquire::Worker
friend

Definition at line 397 of file acquire.h.

◆ Queue

Queue
friend

Definition at line 55 of file acquire-worker.h.

Referenced by Bump(), Dequeue(), Enqueue(), QueueName(), Run(), and Shutdown().

Member Data Documentation

◆ Access

std::string Access
protected

The access method to be used by this worker.

The name of this acquire method (e.g., http).

Todo:
Doesn't this duplicate Config->Access?

Definition at line 84 of file acquire-worker.h.

Referenced by GetConfig().

◆ ActiveSubprocess

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.

Definition at line 104 of file acquire-item.h.

◆ Complete

bool Complete

If true, the entire object has been successfully fetched.

Subclasses should set this to true when appropriate.

Definition at line 119 of file acquire-item.h.

◆ Config

MethodConfig* Config
protected

The configuration of this method. On startup, the target of this pointer is filled in with basic data about the method, as reported by the worker.

Definition at line 78 of file acquire-worker.h.

Referenced by Enqueue(), and QueueName().

◆ Configs

MethodConfig* Configs
protected

The head of the list of acquire method configurations.

Each protocol (http, ftp, gzip, etc) via which files can be fetched can have a representation in this list. The configuration data is filled in by parsing the 100 Capabilities string output by a method on startup (see pkgAcqMethod::pkgAcqMethod and pkgAcquire::GetConfig).

Todo:
why a hand-managed config dictionary instead of std::map?

Definition at line 147 of file acquire.h.

Referenced by GetConfig(), and ~pkgAcquire().

◆ CurItem

pkgAcquire::Queue::QItem* CurItem
private

The item that we currently point at.

Definition at line 599 of file acquire.h.

◆ CurQ

pkgAcquire::Queue* CurQ
private

The next queue to iterate over.

Definition at line 597 of file acquire.h.

◆ CurrentItem

pkgAcquire::Queue::QItem* CurrentItem

The queue entry that is currently being downloaded.

Definition at line 247 of file acquire-worker.h.

◆ d [1/2]

Private *const d
private

dpointer placeholder (for later in case we need it)

Definition at line 358 of file acquire-item.h.

◆ d [2/2]

void* const d
private

dpointer placeholder (for later in case we need it)

Definition at line 50 of file acquire-worker.h.

◆ Debug [1/2]

bool Debug
protected

If true, debugging output will be sent to std::clog.

Definition at line 123 of file acquire-worker.h.

Referenced by Dequeue(), and Enqueue().

◆ Debug [2/2]

bool const Debug
protected

If true, debugging information will be dumped to std::clog.

Definition at line 169 of file acquire.h.

◆ Desc

pkgAcquire::ItemDesc Desc
protected

The item that is currently being downloaded.

Definition at line 309 of file acquire-item.h.

◆ Description

std::string Description

description of this item.

Definition at line 382 of file acquire.h.

◆ DestFile

std::string DestFile

The name of the file into which the retrieved object will be written.

Definition at line 153 of file acquire-item.h.

◆ ErrorText

std::string ErrorText

Contains a textual description of the error encountered if ItemState is StatError or StatAuthError.

Definition at line 93 of file acquire-item.h.

◆ ExpectedAdditionalItems

unsigned int ExpectedAdditionalItems

The number of additional fetch items that are expected once this item is done.

Some items like pkgAcqMeta{Index,Sig} will queue additional items. This variable can be set by the methods if it knows in advance how many items to expect to get a more accurate progress.

Definition at line 148 of file acquire-item.h.

◆ FileSize

unsigned long long FileSize

The size of the object to fetch.

Definition at line 96 of file acquire-item.h.

Referenced by QueueName().

◆ ID

unsigned long ID

A client-supplied unique identifier.

This field is initialized to 0; it is meant to be filled in by clients that wish to use it to uniquely identify items.

APT progress reporting will store an ID there as shown in "Get:42 …"

Definition at line 113 of file acquire-item.h.

◆ InFd

int InFd
protected

A file descriptor connected to the standard output of the subprocess.

Used to read messages and data from the subprocess.

Definition at line 94 of file acquire-worker.h.

Referenced by SetFds().

◆ InReady

bool InReady
protected

Set to true if the worker is in a state in which it might generate data or command responses.

Todo:
Is this right? It's a guess.

Definition at line 113 of file acquire-worker.h.

◆ Items [1/2]

std::vector<Item *> Items
protected

A list of items to download.

This is built monotonically as items are created and only emptied when the download shuts down.

Definition at line 121 of file acquire.h.

Referenced by Add(), Clean(), Remove(), Run(), and Shutdown().

◆ Items [2/2]

QItem* Items
protected

The head of the list of items contained in this queue.

Todo:
why a by-hand list instead of an STL structure?

Definition at line 470 of file acquire.h.

◆ Local

bool Local

If true, the URI of this object is "local".

The only effect of this field is to exclude the object from the download progress indicator's overall statistics.

Definition at line 126 of file acquire-item.h.

◆ LocalOnly

bool LocalOnly

If true, this fetch method does not require network access; all files are to be acquired from the local disk.

Definition at line 663 of file acquire.h.

◆ LockFD

int LockFD
private

FD of the Lock file we acquire in Setup (if any)

Definition at line 96 of file acquire.h.

Referenced by GetLock(), and ~pkgAcquire().

◆ Log

pkgAcquireStatus * Log
protected

The download progress indicator to which progress messages should be sent.

The progress indicator for this download.

Definition at line 72 of file acquire-worker.h.

Referenced by Enqueue(), and Run().

◆ MaxPipeDepth

unsigned long MaxPipeDepth
protected

The maximum number of entries that this queue will attempt to download at once.

Definition at line 494 of file acquire.h.

◆ MessageQueue

std::vector<std::string> MessageQueue
protected

The raw text values of messages received from the worker, in sequence.

Definition at line 128 of file acquire-worker.h.

◆ Name

std::string Name
protected

The name of this queue.

Definition at line 464 of file acquire.h.

Referenced by Enqueue().

◆ NeedsCleanup

bool NeedsCleanup

If true, the subprocess has to carry out some cleanup actions before shutting down.

For instance, the cdrom method needs to unmount the CD after it finishes.

Definition at line 671 of file acquire.h.

◆ Next [1/2]

Queue* Next
private

The next queue in the pkgAcquire object's list of queues.

Definition at line 403 of file acquire.h.

◆ Next [2/2]

MethodConfig* Next

The next link on the acquire method list.

Todo:
Why not an STL container?

Definition at line 638 of file acquire.h.

◆ NextAcquire

Worker* NextAcquire
protected

The next link on the Acquire list.

Definition at line 64 of file acquire-worker.h.

◆ NextQueue

Worker* NextQueue
protected

The next link on the Queue list.

Todo:
This is always NULL; is it just for future use?

Definition at line 61 of file acquire-worker.h.

◆ OutFd

int OutFd
protected

A file descriptor connected to the standard input of the subprocess.

Used to send commands and configuration data to the subprocess.

Definition at line 101 of file acquire-worker.h.

Referenced by SetFds().

◆ OutQueue

std::string OutQueue
protected

Buffers pending writes to the subprocess.

Todo:
Wouldn't a std::dequeue be more appropriate?

Definition at line 134 of file acquire-worker.h.

◆ OutReady

bool OutReady
protected

Set to true if the worker is in a state in which it is legal to send commands to it.

Todo:
Is this right?

Definition at line 120 of file acquire-worker.h.

◆ Owner [1/3]

pkgAcquire* const Owner
protected

The acquire object with which this item is associated.

Definition at line 306 of file acquire-item.h.

◆ Owner [2/3]

Item* Owner

underlying item which is to be downloaded.

Definition at line 386 of file acquire.h.

◆ Owner [3/3]

pkgAcquire* Owner
protected

the download scheduler with which this queue is associated.

Definition at line 484 of file acquire.h.

◆ OwnerQ

Queue* OwnerQ
protected

The Queue with which this worker is associated.

Definition at line 67 of file acquire-worker.h.

◆ PartialSize

unsigned long long PartialSize

How much of the object was already fetched.

Definition at line 99 of file acquire-item.h.

◆ PipeDepth

signed long PipeDepth
protected

The number of entries in this queue that are currently being downloaded.

Definition at line 489 of file acquire.h.

◆ Pipeline

bool Pipeline

If true, this method supports pipelined downloading.

Definition at line 652 of file acquire.h.

◆ PrivSepSocketFd

int PrivSepSocketFd
protected

The socket to send SCM_RIGHTS message through.

Definition at line 105 of file acquire-worker.h.

◆ PrivSepSocketFdChild

int PrivSepSocketFdChild
protected

Definition at line 106 of file acquire-worker.h.

◆ Process

pid_t Process
protected

The PID of the subprocess.

Definition at line 87 of file acquire-worker.h.

◆ QueueCounter

unsigned int QueueCounter

The number of fetch queues into which this item has been inserted.

There is one queue for each source from which an item could be downloaded.

See also
pkgAcquire

Definition at line 138 of file acquire-item.h.

◆ QueueMode

enum pkgAcquire::QueueStrategy QueueMode
protected

Referenced by Initialize(), and QueueName().

◆ Queues

Queue* Queues
protected

The head of the list of active queues.

Todo:
why a hand-managed list of queues instead of std::list or std::set?

Definition at line 128 of file acquire.h.

Referenced by Bump(), Dequeue(), Enqueue(), QueueName(), Run(), Shutdown(), and UriBegin().

◆ Removable

bool Removable

If true, this fetch method acquires files from removable media.

Definition at line 674 of file acquire.h.

◆ Retries

unsigned int Retries

Number of retries.

Definition at line 156 of file acquire-item.h.

◆ Running

bool Running
protected

If true, a download is currently in progress.

Definition at line 171 of file acquire.h.

Referenced by Enqueue(), Remove(), and Run().

◆ SendConfig

bool SendConfig

If true, the worker process should send the entire APT configuration tree to the fetch subprocess when it starts up.

Definition at line 658 of file acquire.h.

◆ ShortDesc

std::string ShortDesc

shorter description of this item.

Definition at line 384 of file acquire.h.

◆ SingleInstance

bool SingleInstance

If true, only one download queue should be created for this method.

Definition at line 649 of file acquire.h.

◆ Status [1/2]

enum pkgAcquire::ItemState Status

Referenced by Shutdown().

◆ Status [2/2]

std::string Status

The most recent status string received from the subprocess.

Definition at line 252 of file acquire-worker.h.

◆ ToFetch

unsigned long ToFetch
protected

The number of files which are to be fetched.

Definition at line 153 of file acquire.h.

Referenced by Dequeue(), Enqueue(), and Run().

◆ URI

std::string URI

URI from which to download this item.

Definition at line 380 of file acquire.h.

Referenced by pkgAcqChangelog::pkgAcqChangelog().

◆ UsedMirror

std::string UsedMirror

Definition at line 128 of file acquire-item.h.

◆ Version

std::string Version

The implementation version of this acquire method.

Definition at line 644 of file acquire.h.

◆ Workers [1/2]

Worker* Workers
protected

The head of the list of active workers.

Todo:
why a hand-managed list of workers instead of std::list or std::set?

Definition at line 135 of file acquire.h.

Referenced by Add(), Remove(), Run(), RunFds(), and SetFds().

◆ Workers [2/2]

pkgAcquire::Worker* Workers
protected

The head of the list of workers associated with this queue.

Todo:
This is plural because support exists in Queue for multiple workers. However, it does not appear that there is any way to actually associate more than one worker with a queue.
Todo:
Why not just use a std::set?

Definition at line 481 of file acquire.h.


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