20 #ifndef PKGLIB_ACQUIRE_ITEM_H
21 #define PKGLIB_ACQUIRE_ITEM_H
24 #include <apt-pkg/hashes.h>
25 #include <apt-pkg/weakptr.h>
28 #ifndef APT_8_CLEANER_HEADERS
29 #include <apt-pkg/indexfile.h>
30 #include <apt-pkg/vendor.h>
31 #include <apt-pkg/sourcelist.h>
32 #include <apt-pkg/pkgrecords.h>
33 #include <apt-pkg/indexrecords.h>
85 void Rename(std::string From,std::string To);
154 std::string UsedMirror;
205 virtual void Done(std::string Message,
unsigned long long Size,std::string Hash,
217 virtual void Start(std::string Message,
unsigned long long Size);
233 virtual std::string
DescURI() = 0;
248 virtual std::string
HashSum() {
return std::string();};
287 enum RenameOnErrorState {
335 virtual void Done(std::string Message,
unsigned long long Size,std::string Md5Hash,
339 virtual bool ParseIndex(std::string
const &IndexFile);
398 virtual void Done(std::string Message,
unsigned long long Size,std::string Md5Hash,
474 std::vector<pkgAcqIndexMergeDiffs*>
const *
const allPatches;
500 virtual void Done(std::string Message,
unsigned long long Size,std::string Md5Hash,
554 bool QueueNextDiff();
567 void Finish(
bool allDone=
false);
632 virtual void Done(std::string Message,
unsigned long long Size,std::string Md5Hash,
661 std::vector<DiffInfo> diffs=std::vector<DiffInfo>());
715 virtual void Done(std::string Message,
unsigned long long Size,std::string Md5Hash,
742 std::string compressExt=
"");
745 void Init(std::string
const &
URI, std::string
const &URIDesc, std::string
const &
ShortDesc);
797 virtual bool IsOptional()
const {
800 virtual bool IsSubIndex()
const {
808 virtual bool IsOptional()
const {
816 virtual bool IsSubIndex()
const {
824 virtual bool IsSubIndex()
const {
880 virtual void Done(std::string Message,
unsigned long long Size,std::string Md5Hash,
976 virtual void Done(std::string Message,
unsigned long long Size, std::string Hash,
983 std::string
URI,std::string URIDesc, std::string
ShortDesc,
993 std::string MetaIndexURI;
996 std::string MetaIndexURIDesc;
999 std::string MetaIndexShortDesc;
1002 std::string MetaSigURI;
1005 std::string MetaSigURIDesc;
1008 std::string MetaSigShortDesc;
1016 std::string
const &
URI, std::string
const &URIDesc, std::string
const &
ShortDesc,
1017 std::string
const &MetaIndexURI, std::string
const &MetaIndexURIDesc, std::string
const &MetaIndexShortDesc,
1018 std::string
const &MetaSigURI, std::string
const &MetaSigURIDesc, std::string
const &MetaSigShortDesc,
1077 virtual void Done(std::string Message,
unsigned long long Size,std::string Hash,
1125 unsigned int Retries;
1134 virtual void Done(std::string Message,
unsigned long long Size,std::string CalcHash,
1137 virtual std::string
HashSum() {
return ExpectedHash.toStr(); };
1172 std::string Desc, std::string
ShortDesc,
1173 const std::string &DestDir=
"",
const std::string &DestFilename=
"",
1174 bool IsIndexFile=
false);
virtual std::string DescURI()
A "descriptive" URI-like string.
Definition: acquire-item.h:1079
unsigned long ID
A client-supplied unique identifier.
Definition: acquire-item.h:140
virtual std::string DescURI()
A "descriptive" URI-like string.
Definition: acquire-item.h:400
The diff is currently being uncompressed.
Definition: acquire-item.h:617
std::string Description
description of the file being downloaded.
Definition: acquire-item.h:468
void Dequeue(Item *Item)
Remove all fetch requests for this item from all queues.
Definition: acquire.cc:243
virtual void Failed(std::string Message, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object couldn't be fetched.
Definition: acquire-item.cc:256
virtual void Done(std::string Message, unsigned long long Size, std::string Md5Hash, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object was fetched successfully.
Definition: acquire-item.cc:268
unsigned long long FileSize
The size of the object to fetch.
Definition: acquire-item.h:123
std::string URI
The URI from which to download this item.
Definition: acquire.h:376
virtual void Done(std::string Message, unsigned long long Size, std::string CalcHash, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object was fetched successfully.
Definition: acquire-item.cc:2207
std::string URI
A URI from which the index file can be downloaded.
Definition: acquire-item.h:784
virtual bool IsTrusted()
Definition: acquire-item.h:254
virtual void Start(std::string Message, unsigned long long Size)
Invoked when the worker starts to fetch this object.
Definition: acquire-item.cc:101
virtual std::string DescURI()
A "descriptive" URI-like string.
Definition: acquire-item.h:634
pkgAcquire::ItemDesc Desc
The item that is currently being downloaded.
Definition: acquire-item.h:326
virtual void Done(std::string Message, unsigned long long Size, std::string Md5Hash, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object was fetched successfully.
Definition: acquire-item.cc:725
virtual ~Item()
Remove this item from its owner's queue by invoking pkgAcquire::Remove.
Definition: acquire-item.cc:58
virtual std::string DescURI()
A "descriptive" URI-like string.
Definition: acquire-item.h:718
pkgAcqDiffIndex(pkgAcquire *Owner, std::string URI, std::string URIDesc, std::string ShortDesc, HashString ExpectedHash)
Create a new pkgAcqDiffIndex.
Definition: acquire-item.cc:335
virtual void Failed(std::string Message, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object couldn't be fetched.
Definition: acquire-item.cc:67
bool Local
If true, the URI of this object is "local".
Definition: acquire-item.h:153
bool Debug
If true, debugging output will be written to std::clog.
Definition: acquire-item.h:450
HashString ExpectedHash
HashSum of the package index file that is being reconstructed.
Definition: acquire-item.h:465
bool Debug
If true, debugging information will be written to std::clog.
Definition: acquire-item.h:323
std::string ShortDesc
A shorter description of the index file.
Definition: acquire-item.h:790
pkgRecords * Recs
A package records object, used to look up the file corresponding to each version of the package...
Definition: acquire-item.h:1046
unsigned int Retries
How many (more) times to try to find a new source from which to download this package version if it f...
Definition: acquire-item.h:1064
std::string sha1
Definition: acquire-item.h:307
Represents a single download source from which an item should be downloaded.
Definition: acquire.h:373
virtual std::string Custom600Headers()
Custom headers to be sent to the fetch process.
Definition: acquire-item.h:227
std::string file
Definition: acquire-item.h:304
ItemState
The current status of this item.
Definition: acquire-item.h:90
Information about an subindex index file.
Definition: acquire-item.h:822
pkgCache - Structure definitions for the cache file
virtual std::string Custom600Headers()
Custom headers to be sent to the fetch process.
Definition: acquire-item.cc:245
void Dequeue()
Remove this item from its owner's queue.
Definition: acquire-item.h:74
virtual std::string DescURI()
A "descriptive" URI-like string.
Definition: acquire-item.h:502
Item(pkgAcquire *Owner)
Initialize an item.
Definition: acquire-item.cc:47
pkgAcqIndex(pkgAcquire *Owner, std::string URI, std::string URIDesc, std::string ShortDesc, HashString ExpectedHash, std::string compressExt="")
Create a pkgAcqIndex.
Definition: acquire-item.cc:901
virtual void Failed(std::string Message, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object couldn't be fetched.
Definition: acquire-item.cc:2266
pkgAcqArchive(pkgAcquire *Owner, pkgSourceList *Sources, pkgRecords *Recs, pkgCache::VerIterator const &Version, std::string &StoreFilename)
Create a new pkgAcqArchive.
Definition: acquire-item.cc:1836
Information about an index file.
Definition: acquire-item.h:780
virtual std::string ShortDesc()
Short item description.
Definition: acquire-item.h:238
std::string ServerSha1
Definition: acquire-item.h:605
virtual std::string HashSum()
HashSum.
Definition: acquire-item.h:1082
virtual std::string DescURI()=0
A "descriptive" URI-like string.
pkgAcquire::ItemDesc Desc
The fetch command that is currently being processed.
Definition: acquire-item.h:1036
pkgAcqSubIndex(pkgAcquire *Owner, std::string const &URI, std::string const &URIDesc, std::string const &ShortDesc, HashString const &ExpectedHash)
Create a new pkgAcqSubIndex.
Definition: acquire-item.cc:220
An acquire item that is responsible for fetching an index {{{ file (e.g., Packages or Sources)...
Definition: acquire-item.h:671
DiffState
Definition: acquire-item.h:608
std::string RealURI
The URI of the package index file that is being reconstructed.
Definition: acquire-item.h:584
An item that is responsible for fetching an index file of {{{ package list diffs and starting the pac...
Definition: acquire-item.h:366
The item is currently being downloaded.
Definition: acquire-item.h:96
std::string RealURI
URI of the package index file that is being reconstructed.
Definition: acquire-item.h:460
HashString ExpectedHash
The Hash that this file should have after download.
Definition: acquire-item.h:330
std::string CompressionExtension
The compression-related file extensions that are being added to the downloaded file one by one if fir...
Definition: acquire-item.h:709
void QueueURI(ItemDesc &Item)
Insert this item into its owner's queue.
Definition: acquire-item.h:70
The diff is currently being fetched.
Definition: acquire-item.h:614
std::string & StoreFilename
A location in which the actual filename of the package should be stored.
Definition: acquire-item.h:1054
pkgAcquire::ItemDesc Desc
A description of the item that is currently being downloaded.
Definition: acquire-item.h:579
The core download scheduler. {{{.
Definition: acquire.h:93
An item that is responsible for fetching server-merge patches {{{ that need to be applied to a given ...
Definition: acquire-item.h:541
pkgCache::VerFileIterator Vf
The next file for this version to try to download.
Definition: acquire-item.h:1057
Definition: sourcelist.h:46
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.
Definition: acquire-item.cc:111
std::string Description
A description of the index file.
Definition: acquire-item.h:787
pkgAcquire::ItemDesc Desc
description of the item that is currently being downloaded.
Definition: acquire-item.h:455
virtual void Failed(std::string Message, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object couldn't be fetched.
Definition: acquire-item.cc:547
Information about an optional index file.
Definition: acquire-item.h:806
An item that is responsible for fetching a SubIndex {{{.
Definition: acquire-item.h:319
virtual std::string HashSum()
HashSum.
Definition: acquire-item.h:719
bool Debug
If true, debugging information will be written to std::clog.
Definition: acquire-item.h:370
An item that is responsible for fetching a package file. {{{.
Definition: acquire-item.h:1029
std::string RealURI
The URI of the index file to recreate at our end (either by downloading it or by applying partial pat...
Definition: acquire-item.h:378
virtual void Done(std::string Message, unsigned long long Size, std::string Md5Hash, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object was fetched successfully.
Definition: acquire-item.cc:561
virtual void Failed(std::string Message, pkgAcquire::MethodConfig *Cnf)
Called when the patch file failed to be downloaded.
Definition: acquire-item.cc:627
virtual void Failed(std::string Message, pkgAcquire::MethodConfig *Cnf)
Called when the patch file failed to be downloaded.
Definition: acquire-item.cc:810
pkgCache::VerIterator Version
The package version being fetched.
Definition: acquire-item.h:1033
The diff is currently being fetched.
Definition: acquire-item.h:480
virtual std::string Custom600Headers()
Custom headers to be sent to the fetch process.
Definition: acquire-item.cc:2286
std::vector< DiffInfo > available_patches
Definition: acquire-item.h:602
unsigned long size
Definition: acquire-item.h:310
pkgAcqIndexDiffs(pkgAcquire *Owner, std::string URI, std::string URIDesc, std::string ShortDesc, HashString ExpectedHash, std::string ServerSha1, std::vector< DiffInfo > diffs=std::vector< DiffInfo >())
Create an index diff item.
Definition: acquire-item.cc:596
pkgAcquire::ItemDesc Desc
The download request that is currently being processed.
Definition: acquire-item.h:696
virtual std::string Custom600Headers()
Custom headers to be sent to the fetch process.
Definition: acquire-item.cc:974
bool Trusted
true if this version file is being downloaded from a trusted source.
Definition: acquire-item.h:1069
Definition: cacheiterators.h:185
bool Complete
If true, the entire object has been successfully fetched.
Definition: acquire-item.h:146
std::string Description
Definition: acquire-item.h:592
std::string DestFile
The name of the file into which the retrieved object will be written.
Definition: acquire-item.h:169
Definition: indexrecords.h:20
pkgAcquire::ItemDesc Desc
The item that is currently being downloaded.
Definition: acquire-item.h:373
pkgAcquire * GetOwner()
Definition: acquire-item.h:251
virtual void Failed(std::string Message, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object couldn't be fetched.
Definition: acquire-item.cc:2110
unsigned long long PartialSize
How much of the object was already fetched.
Definition: acquire-item.h:126
void Rename(std::string From, std::string To)
Rename a file without modifying its timestamp.
Definition: acquire-item.cc:134
bool RenameOnError(RenameOnErrorState const state)
Rename failed file and set error.
Definition: acquire-item.cc:146
virtual std::string Custom600Headers()
Custom headers to be sent to the fetch process.
Definition: acquire-item.cc:383
Represents the process by which a pkgAcquire object should {{{ retrieve a file or a collection of fil...
Definition: acquire-item.h:58
The item was could not be downloaded because of a transient network error (e.g. network down) ...
Definition: acquire-item.h:114
bool Verify
Verify for correctness by checking if a "Package" tag is found in the index. This can be set to false...
Definition: acquire-item.h:691
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.
Definition: acquire-item.cc:2060
Retrieve an arbitrary file to the current directory. {{{.
Definition: acquire-item.h:1114
virtual std::string ShortDesc()
Short item description.
Definition: acquire-item.h:1080
pkgAcqIndexMergeDiffs(pkgAcquire *Owner, std::string const &URI, std::string const &URIDesc, std::string const &ShortDesc, HashString const &ExpectedHash, DiffInfo const &patch, std::vector< pkgAcqIndexMergeDiffs * > const *const allPatches)
Create an index merge-diff item.
Definition: acquire-item.cc:781
The diff is in an unknown state.
Definition: acquire-item.h:611
The diff is currently being applied.
Definition: acquire-item.h:620
std::string ErrorText
Contains a textual description of the error encountered if #Status is StatError or StatAuthError...
Definition: acquire-item.h:120
The item was downloaded but its authenticity could not be verified.
Definition: acquire-item.h:109
bool Debug
If true, debugging output will be written to std::clog.
Definition: acquire-item.h:574
virtual std::string HashSum()
HashSum.
Definition: acquire-item.h:248
virtual bool IsTrusted()
Definition: acquire-item.cc:2147
void Enqueue(ItemDesc &Item)
Insert the given fetch request into the appropriate queue.
Definition: acquire.cc:200
std::string Description
A description of the Packages file (stored in pkgAcquire::ItemDesc::Description). ...
Definition: acquire-item.h:393
unsigned int QueueCounter
The number of fetch queues into which this item has been inserted.
Definition: acquire-item.h:164
something bad happened and fallback was triggered
Definition: acquire-item.h:489
std::string RealURI
The object that is actually being fetched (minus any compression-related extensions).
Definition: acquire-item.h:701
bool Decompression
If true, the index file has been decompressed.
Definition: acquire-item.h:676
An item that is responsible for fetching client-merge patches {{{ that need to be applied to a given ...
Definition: acquire-item.h:443
virtual std::string HashSum()
HashSum.
Definition: acquire-item.h:1137
std::vector< pkgAcqIndexMergeDiffs * > const *const allPatches
list of all download items for the patches
Definition: acquire-item.h:474
virtual void Finished()
Invoked by the worker when the download is completely done.
Definition: acquire-item.cc:2155
virtual void Done(std::string Message, unsigned long long Size, std::string Md5Hash, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object was fetched successfully.
Definition: acquire-item.cc:1020
virtual void Finished()
Invoked by the worker when the download is completely done.
Definition: acquire-item.h:241
Information about an subindex index file.
Definition: acquire-item.h:814
HashString ExpectedHash
The expected hashsum of the decompressed index file.
Definition: acquire-item.h:704
virtual std::string DescURI()
A "descriptive" URI-like string.
Definition: acquire-item.h:337
virtual std::string DescURI()
A "descriptive" URI-like string.
Definition: acquire-item.h:1136
HashString ExpectedHash
The Hash that the real index file should have after all patches have been applied.
Definition: acquire-item.h:383
DiffState
Definition: acquire-item.h:477
Definition: pkgrecords.h:24
An error was encountered while downloading this item.
Definition: acquire-item.h:104
std::string CurrentPackagesFile
The index file which will be patched to generate the new file.
Definition: acquire-item.h:388
The item is waiting to be downloaded.
Definition: acquire-item.h:93
Information about the properties of a single acquire method. {{{.
Definition: acquire.h:595
virtual void Done(std::string Message, unsigned long long Size, std::string Md5Hash, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object was fetched successfully.
Definition: acquire-item.cc:832
pkgSourceList * Sources
The list of sources from which to pick archives to download this package from.
Definition: acquire-item.h:1041
pkgAcquire * Owner
The acquire object with which this item is associated.
Definition: acquire-item.h:63
bool Erase
If true, the partially downloaded file will be removed when the download completes.
Definition: acquire-item.h:681
void ReportMirrorFailure(std::string FailCode)
Report mirror problem.
Definition: acquire-item.cc:174
struct DiffInfo const patch
information about the current patch
Definition: acquire-item.h:471
The diff is currently being applied.
Definition: acquire-item.h:483
Definition: cacheiterators.h:385
the work with this diff is done
Definition: acquire-item.h:486
virtual void Failed(std::string Message, pkgAcquire::MethodConfig *Cnf)
Invoked by the acquire worker when the object couldn't be fetched.
Definition: acquire-item.cc:993
const char * Mode
If not NULL, contains the name of a subprocess that is operating on this object (for instance...
Definition: acquire-item.h:131
bool QueueNext()
Queue up the next available file for this version.
Definition: acquire-item.cc:1922
std::string MetaKey
The key by which this index file should be looked up within the meta signature file.
Definition: acquire-item.h:795
HashString ExpectedHash
The HashSum of the package index file that is being reconstructed.
Definition: acquire-item.h:589
bool ParseDiffIndex(std::string IndexDiffFile)
Parse the Index file for a set of Packages diffs.
Definition: acquire-item.cc:398
HashString ExpectedHash
The hashsum of this package.
Definition: acquire-item.h:1049
Information about an index patch (aka diff).
Definition: acquire-item.h:302
pkgAcqFile(pkgAcquire *Owner, std::string URI, std::string Hash, unsigned long long Size, std::string Desc, std::string ShortDesc, const std::string &DestDir="", const std::string &DestFilename="", bool IsIndexFile=false)
Create a new pkgAcqFile object.
Definition: acquire-item.cc:2166
std::string ShortDesc
Definition: acquire.h:380
The item has been successfully downloaded.
Definition: acquire-item.h:99