apt
0.9.9.1~ubuntu1
|
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 | |
virtual void | Failed (std::string Message, pkgAcquire::MethodConfig *Cnf) |
Invoked by the acquire worker when the object couldn't be fetched. 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 | Start (std::string Message, unsigned long long Size) |
Invoked when the worker starts to fetch this object. 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 std::string | ShortDesc () |
Short item description. More... | |
virtual void | Finished () |
Invoked by the worker when the download is completely done. | |
virtual std::string | HashSum () |
HashSum. More... | |
pkgAcquire * | GetOwner () |
virtual bool | IsTrusted () |
void | ReportMirrorFailure (std::string FailCode) |
Report mirror problem. More... | |
Item (pkgAcquire *Owner) | |
Initialize an item. More... | |
virtual | ~Item () |
Remove this item from its owner's queue by invoking pkgAcquire::Remove. | |
![]() | |
void | AddWeakPointer (WeakPointable **weakptr) |
void | RemoveWeakPointer (WeakPointable **weakptr) |
~WeakPointable () | |
Public Attributes | |
enum pkgAcquire::Item::ItemState | Status |
std::string | ErrorText |
Contains a textual description of the error encountered if #Status 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. | |
const char * | Mode |
If not NULL, contains the name of a subprocess that is operating on this object (for instance, "gzip" or "gpgv"). | |
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... | |
std::string | DestFile |
The name of the file into which the retrieved object will be written. | |
Protected Member Functions | |
void | QueueURI (ItemDesc &Item) |
Insert this item into its owner's queue. More... | |
void | Dequeue () |
Remove this item from its owner's queue. | |
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. | |
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.
enum ItemState |
The current status of this 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. |
References pkgAcquire::Add(), and StatIdle.
|
inlinevirtual |
Custom headers to be sent to the fetch process.
Reimplemented in pkgAcqFile, pkgAcqMetaClearSig, pkgAcqMetaIndex, pkgAcqMetaSig, pkgAcqIndexTrans, pkgAcqIndex, pkgAcqDiffIndex, and pkgAcqSubIndex.
Referenced by pkgAcquire::Worker::QueueItem().
|
pure virtual |
A "descriptive" URI-like string.
Implemented in pkgAcqFile, pkgAcqArchive, pkgAcqMetaIndex, pkgAcqMetaSig, pkgAcqIndex, pkgAcqIndexDiffs, pkgAcqDiffIndex, and pkgAcqSubIndex.
Referenced by pkgAcquire::Worker::RunMessages(), and 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.
Referenced by pkgAcquire::Worker::RunMessages().
|
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.
References pkgAcquire::Dequeue(), and pkgAcquire::MethodConfig::LocalOnly.
Referenced by pkgAcquire::Worker::RunMessages().
|
inline |
References Owner.
Referenced by pkgAcquire::Worker::RunMessages().
|
inlinevirtual |
HashSum.
Reimplemented in pkgAcqFile, pkgAcqArchive, and pkgAcqIndex.
Referenced by pkgAcquire::Worker::RunMessages().
|
inlinevirtual |
Reimplemented in pkgAcqArchive.
|
inlineprotected |
Insert this item into its owner's queue.
References pkgAcquire::Enqueue(), and Owner.
Referenced by pkgAcqSubIndex::Done(), pkgAcqIndexDiffs::Done(), pkgAcqIndex::Done(), pkgAcqMetaSig::Done(), pkgAcqMetaIndex::Done(), pkgAcqFile::Done(), pkgAcqFile::Failed(), pkgAcqDiffIndex::pkgAcqDiffIndex(), pkgAcqFile::pkgAcqFile(), pkgAcqMetaIndex::pkgAcqMetaIndex(), pkgAcqMetaSig::pkgAcqMetaSig(), pkgAcqSubIndex::pkgAcqSubIndex(), pkgAcqArchive::QueueNext(), and pkgAcqMetaIndex::RetrievalDone().
|
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. |
Referenced by pkgAcqMetaIndex::AuthDone(), pkgAcqSubIndex::Done(), pkgAcqDiffIndex::Done(), pkgAcqIndexDiffs::Done(), pkgAcqIndex::Done(), pkgAcqMetaSig::Done(), pkgAcqMetaIndex::Done(), pkgAcqArchive::Done(), pkgAcqFile::Done(), pkgAcqMetaSig::Failed(), pkgAcqMetaIndex::Failed(), pkgAcqMetaClearSig::pkgAcqMetaClearSig(), pkgAcqMetaSig::pkgAcqMetaSig(), and pkgAcqMetaIndex::RetrievalDone().
void 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 |
Referenced by pkgAcqIndex::Done(), and pkgAcqMetaIndex::Failed().
|
inlinevirtual |
Short item description.
Reimplemented in pkgAcqArchive.
References DescURI().
Referenced by pkgAcqIndex::Custom600Headers(), pkgAcqDiffIndex::pkgAcqDiffIndex(), pkgAcqFile::pkgAcqFile(), pkgAcqIndexDiffs::pkgAcqIndexDiffs(), pkgAcqMetaIndex::pkgAcqMetaIndex(), pkgAcqMetaSig::pkgAcqMetaSig(), and pkgAcqSubIndex::pkgAcqSubIndex().
|
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. |
Referenced by pkgAcquire::Worker::RunMessages().
bool Complete |
If true, the entire object has been successfully fetched.
Subclasses should set this to true when appropriate.
Referenced by pkgAcqSubIndex::Done(), pkgAcqDiffIndex::Done(), pkgAcqIndex::Done(), pkgAcqMetaSig::Done(), pkgAcqMetaIndex::Done(), pkgAcqArchive::Done(), pkgAcqFile::Done(), pkgAcquire::Enqueue(), pkgAcqSubIndex::Failed(), pkgAcqDiffIndex::Failed(), pkgAcqIndexTrans::Failed(), pkgAcqMetaSig::Failed(), pkgAcqArchive::Finished(), pkgAcqDiffIndex::ParseDiffIndex(), pkgAcqArchive::QueueNext(), and pkgAcqMetaIndex::RetrievalDone().
unsigned long 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 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.
Referenced by pkgAcqSubIndex::Done(), pkgAcqIndexDiffs::Done(), pkgAcqIndex::Done(), pkgAcqMetaSig::Done(), pkgAcqArchive::Done(), pkgAcqFile::Done(), pkgAcquire::Enqueue(), pkgAcqArchive::QueueNext(), and pkgAcqMetaIndex::RetrievalDone().
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.
Referenced by pkgAcquire::Queue::Dequeue(), pkgAcquire::Queue::Enqueue(), and pkgAcquire::Queue::ItemDone().