Represents the process by which a pkgAcquire object should {{{ retrieve a file or a collection of files. More...
#include <acquire-item.h>
Public Types | |
enum | ItemState { StatIdle, StatFetching, StatDone, StatError, StatAuthError, StatTransientNetworkError } |
The current status of this item. More... | |
Public Member Functions | |
Item (pkgAcquire *Owner) | |
Initialize an item. More... | |
virtual | ~Item () |
Remove this item from its owner's queue by invoking pkgAcquire::Remove. More... | |
void | AddWeakPointer (WeakPointable **weakptr) |
Add a new weak pointer. More... | |
virtual std::string | Custom600Headers () |
Custom headers to be sent to the fetch process. More... | |
virtual std::string | DescURI ()=0 |
A "descriptive" URI-like string. More... | |
virtual void | Done (std::string Message, unsigned long long Size, std::string Hash, pkgAcquire::MethodConfig *Cnf) |
Invoked by the acquire worker when the object was fetched successfully. More... | |
virtual void | Failed (std::string Message, pkgAcquire::MethodConfig *Cnf) |
Invoked by the acquire worker when the object couldn't be fetched. More... | |
virtual void | Finished () |
Invoked by the worker when the download is completely done. More... | |
pkgAcquire * | GetOwner () |
virtual std::string | HashSum () |
HashSum. More... | |
virtual bool | IsTrusted () |
void | RemoveWeakPointer (WeakPointable **weakptr) |
Remove the weak pointer from the list of weak pointers. More... | |
void | ReportMirrorFailure (std::string FailCode) |
Report mirror problem. More... | |
virtual std::string | ShortDesc () |
Short item description. More... | |
virtual void | Start (std::string Message, unsigned long long Size) |
Invoked when the worker starts to fetch this object. More... | |
Public Attributes | |
bool | Complete |
If true, the entire object has been successfully fetched. More... | |
std::string | DestFile |
The name of the file into which the retrieved object will be written. More... | |
std::string | ErrorText |
Contains a textual description of the error encountered if Status is StatError or StatAuthError. More... | |
unsigned long long | FileSize |
The size of the object to fetch. More... | |
unsigned long | ID |
A client-supplied unique identifier. More... | |
bool | Local |
If true, the URI of this object is "local". More... | |
const char * | Mode |
If not NULL, contains the name of a subprocess that is operating on this object (for instance, "gzip" or "gpgv"). More... | |
unsigned long long | PartialSize |
How much of the object was already fetched. More... | |
unsigned int | QueueCounter |
The number of fetch queues into which this item has been inserted. More... | |
enum pkgAcquire::Item::ItemState | Status |
std::string | UsedMirror |
Protected Member Functions | |
void | Dequeue () |
Remove this item from its owner's queue. More... | |
void | QueueURI (ItemDesc &Item) |
Insert this item into its owner's queue. More... | |
void | Rename (std::string From, std::string To) |
Rename a file without modifying its timestamp. More... | |
Protected Attributes | |
pkgAcquire * | Owner |
The acquire object with which this item is associated. More... | |
Represents the process by which a pkgAcquire object should {{{ retrieve a file or a collection of files.
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.
The current status of this item.
pkgAcquire::Item::Item | ( | pkgAcquire * | Owner | ) |
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).
Initializes all fields of the item other than Owner to 0, false, or the empty string.
Owner | The new owner of this item. |
|
virtual |
Remove this item from its owner's queue by invoking pkgAcquire::Remove.
|
inlineinherited |
Add a new weak pointer.
References WeakPointable::pointers.
|
inlinevirtual |
Custom headers to be sent to the fetch process.
Reimplemented in pkgAcqFile, pkgAcqMetaClearSig, pkgAcqMetaIndex, pkgAcqMetaSig, pkgAcqIndexTrans, pkgAcqIndex, pkgAcqDiffIndex, and pkgAcqSubIndex.
|
inlineprotected |
Remove this item from its owner's queue.
References pkgAcquire::Dequeue(), and Owner.
|
pure virtual |
A "descriptive" URI-like string.
Implemented in pkgAcqFile, pkgAcqArchive, pkgAcqMetaIndex, pkgAcqMetaSig, pkgAcqIndex, pkgAcqIndexDiffs, pkgAcqDiffIndex, and pkgAcqSubIndex.
Referenced by ShortDesc().
|
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.
Message | Data from the acquire method. Use LookupTag() to parse it. |
Size | The size of the object that was fetched. |
Hash | The HashSum of the object that was fetched. |
Cnf | The method via which the object was fetched. |
Reimplemented in pkgAcqFile, pkgAcqArchive, pkgAcqMetaIndex, pkgAcqMetaSig, pkgAcqIndex, pkgAcqIndexDiffs, pkgAcqDiffIndex, and pkgAcqSubIndex.
|
virtual |
Invoked by the acquire worker when the object couldn't be fetched.
This is a branch of the continuation of the fetch process.
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. |
Reimplemented in pkgAcqFile, pkgAcqArchive, pkgAcqMetaClearSig, pkgAcqMetaIndex, pkgAcqMetaSig, pkgAcqIndexTrans, pkgAcqIndex, pkgAcqIndexDiffs, pkgAcqDiffIndex, and pkgAcqSubIndex.
|
inlinevirtual |
Invoked by the worker when the download is completely done.
Reimplemented in pkgAcqArchive.
|
inline |
References Owner.
|
inlinevirtual |
HashSum.
Reimplemented in pkgAcqFile, pkgAcqArchive, and pkgAcqIndex.
|
inlinevirtual |
Reimplemented in pkgAcqArchive.
|
inlineprotected |
Insert this item into its owner's queue.
References pkgAcquire::Enqueue(), and Owner.
|
inlineinherited |
Remove the weak pointer from the list of weak pointers.
References WeakPointable::pointers.
|
protected |
Rename a file without modifying its timestamp.
Many item methods call this as their final action.
From | The file to be renamed. |
To | The new name of #From. If #To exists it will be overwritten. |
void pkgAcquire::Item::ReportMirrorFailure | ( | std::string | FailCode | ) |
Report mirror problem.
This allows reporting mirror failures back to a centralized server. The apt-report-mirror-failure script is called for this
FailCode | A short failure string that is send |
|
inlinevirtual |
Short item description.
Reimplemented in pkgAcqArchive.
References DescURI().
|
virtual |
Invoked when the worker starts to fetch this object.
Message | RFC822-formatted data from the worker process. Use LookupTag() to parse it. |
Size | The size of the object being fetched. |
bool pkgAcquire::Item::Complete |
If true, the entire object has been successfully fetched.
Subclasses should set this to true when appropriate.
std::string pkgAcquire::Item::DestFile |
The name of the file into which the retrieved object will be written.
std::string pkgAcquire::Item::ErrorText |
Contains a textual description of the error encountered if Status is StatError or StatAuthError.
unsigned long long pkgAcquire::Item::FileSize |
The size of the object to fetch.
unsigned long pkgAcquire::Item::ID |
A client-supplied unique identifier.
This field is initalized to 0; it is meant to be filled in by clients that wish to use it to uniquely identify items.
bool pkgAcquire::Item::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.
const char* pkgAcquire::Item::Mode |
If not NULL, contains the name of a subprocess that is operating on this object (for instance, "gzip" or "gpgv").
|
protected |
The acquire object with which this item is associated.
Referenced by Dequeue(), GetOwner(), and QueueURI().
unsigned long long pkgAcquire::Item::PartialSize |
How much of the object was already fetched.
unsigned int pkgAcquire::Item::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.
enum pkgAcquire::Item::ItemState pkgAcquire::Item::Status |
std::string pkgAcquire::Item::UsedMirror |