apt 3.0.3
commandline package manager
acquire-item.h
Go to the documentation of this file.
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3/* ######################################################################
4
5 Acquire Item - Item to acquire
6
7 When an item is instantiated it will add it self to the local list in
8 the Owner Acquire class. Derived classes will then call QueueURI to
9 register all the URI's they wish to fetch at the initial moment.
10
11 Three item classes are provided to provide functionality for
12 downloading of Index, Translation and Packages files.
13
14 A Archive class is provided for downloading .deb files. It does Hash
15 checking and source location as well as a retry algorithm.
16
17 ##################################################################### */
18 /*}}}*/
19#ifndef PKGLIB_ACQUIRE_ITEM_H
20#define PKGLIB_ACQUIRE_ITEM_H
21
22#include <apt-pkg/acquire.h>
23#include <apt-pkg/hashes.h>
24#include <apt-pkg/indexfile.h>
25#include <apt-pkg/pkgcache.h>
26#include <apt-pkg/weakptr.h>
27
28#include <map>
29#include <string>
30#include <unordered_map>
31#include <vector>
32
33
40class pkgRecords;
41class pkgSourceList;
44class metaIndex;
45
46class APT_PUBLIC pkgAcquire::Item : public WeakPointable /*{{{*/
59{
60 public:
61
89
93 std::string ErrorText;
94
96 unsigned long long FileSize;
97
99 unsigned long long PartialSize;
100
104 std::string ActiveSubprocess;
105
113 unsigned long ID;
114
120
126 bool Local;
127
128 std::string UsedMirror;
129
138 unsigned int QueueCounter;
139
149
153 std::string DestFile;
154
156 unsigned int Retries;
157
171 virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf);
172 APT_HIDDEN void FailMessage(std::string const &Message);
173
193 virtual bool VerifyDone(std::string const &Message,
194 pkgAcquire::MethodConfig const * const Cnf);
195
214 virtual void Done(std::string const &Message, HashStringList const &Hashes,
215 pkgAcquire::MethodConfig const *const Cnf);
216
226 virtual void Start(std::string const &Message, unsigned long long const Size);
227
236 virtual std::string Custom600Headers() const;
237 // this is more a hack than a proper external interface, hence hidden
238 APT_HIDDEN std::unordered_map<std::string, std::string> &ModifyCustomFields();
239 // this isn't the super nicest interface either…
240 APT_HIDDEN bool PopAlternativeURI(std::string &NewURI);
241 APT_HIDDEN bool IsGoodAlternativeURI(std::string const &AltUri) const;
242 APT_HIDDEN void PushAlternativeURI(std::string &&NewURI, std::unordered_map<std::string, std::string> &&fields, bool const at_the_back);
243 APT_HIDDEN void RemoveAlternativeSite(std::string const &AltUri);
244
249 virtual std::string DescURI() const = 0;
254 virtual std::string ShortDesc() const;
255
257 virtual void Finished();
258
262 std::string HashSum() const;
263
270 virtual bool HashesRequired() const { return true; }
271
274 pkgAcquire::ItemDesc &GetItemDesc();
275
277 virtual bool IsTrusted() const;
278
283 void SetActiveSubprocess(std::string const &subprocess);
284
293 explicit Item(pkgAcquire * const Owner);
294
298 virtual ~Item();
299
300 bool APT_HIDDEN IsRedirectionLoop(std::string const &NewURI);
302 int APT_HIDDEN Priority();
303
305 void APT_HIDDEN FetchAfter(time_point FetchAfter);
306 time_point APT_HIDDEN FetchAfter();
307
308 protected:
311
313 pkgAcquire::ItemDesc Desc;
314
315 enum RenameOnErrorState {
316 HashSumMismatch,
317 SizeMismatch,
318 InvalidFormat,
319 SignatureError,
320 NotClearsigned,
321 MaximumSizeExceeded,
322 PDiffError,
323 };
324
329 bool RenameOnError(RenameOnErrorState const state);
330
341 virtual bool QueueURI(ItemDesc &Item);
342
344 void Dequeue();
345
355 bool Rename(std::string const &From, std::string const &To);
356
358 virtual std::string GetFinalFilename() const;
359
360 private:
361 class Private;
362 Private * const d;
363
364 friend class pkgAcqMetaBase;
365 friend class pkgAcqMetaClearSig;
366};
367 /*}}}*/
368class APT_HIDDEN pkgAcqTransactionItem: public pkgAcquire::Item /*{{{*/
370{
371 void * const d;
372 protected:
373 HashStringList GetExpectedHashesFor(std::string const &MetaKey) const;
374
375 bool QueueURI(pkgAcquire::ItemDesc &Item) override;
376
377 public:
378 IndexTarget const Target;
379
381 std::string PartialFile;
382
385
386 enum TransactionStates {
387 TransactionStarted,
388 TransactionCommit,
389 TransactionAbort,
390 };
391 virtual bool TransactionState(TransactionStates const state);
392
393 [[nodiscard]] std::string DescURI() const override { return Target.URI; }
394 [[nodiscard]] HashStringList GetExpectedHashes() const override;
395 [[nodiscard]] virtual std::string GetMetaKey() const;
396 [[nodiscard]] bool HashesRequired() const override;
397 [[nodiscard]] virtual bool AcquireByHash() const;
398
399 pkgAcqTransactionItem(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager, IndexTarget const &Target) APT_NONNULL(2, 3);
400 ~pkgAcqTransactionItem() override;
401
402 friend class pkgAcqMetaBase;
403 friend class pkgAcqMetaClearSig;
404};
405 /*}}}*/
406class APT_HIDDEN pkgAcqMetaBase : public pkgAcqTransactionItem /*{{{*/
408{
409 void * const d;
410 protected:
411 std::vector<pkgAcqTransactionItem*> Transaction;
412
416
426 bool CheckDownloadDone(pkgAcqTransactionItem * const I, const std::string &Message, HashStringList const &Hashes) const;
427
429 void QueueForSignatureVerify(pkgAcqTransactionItem * const I, std::string const &File, std::string const &Signature);
430
431 [[nodiscard]] std::string Custom600Headers() const override;
432
443 bool CheckAuthDone(std::string const &Message, pkgAcquire::MethodConfig const *const Cnf);
444
446 bool CheckStopAuthentication(pkgAcquire::Item * const I, const std::string &Message);
447
453 bool VerifyVendor(std::string const &Message);
454
455 bool TransactionState(TransactionStates state) override;
456
457 public:
458 // This refers more to the Transaction-Manager than the actual file
459 bool IMSHit;
460 TransactionStates State;
461 std::string BaseURI;
462
463 bool QueueURI(pkgAcquire::ItemDesc &Item) override;
464 [[nodiscard]] HashStringList GetExpectedHashes() const override;
465 [[nodiscard]] bool HashesRequired() const override;
466
467 // transaction code
468 void Add(pkgAcqTransactionItem * const I);
469 void AbortTransaction();
470 bool TransactionHasError() const;
471 void CommitTransaction();
472
475 void TransactionStageCopy(pkgAcqTransactionItem * const I,
476 const std::string &From,
477 const std::string &To);
480 void TransactionStageRemoval(pkgAcqTransactionItem * const I, const std::string &FinalFile);
481
483 [[nodiscard]] std::string GetFinalFilename() const override;
484
485 pkgAcqMetaBase(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager,
486 IndexTarget const &DataTarget) APT_NONNULL(2, 3);
487 ~pkgAcqMetaBase() override;
488};
489 /*}}}*/
500class APT_HIDDEN pkgAcqMetaIndex : public pkgAcqMetaBase
501{
502 void * const d;
503 protected:
504 IndexTarget const DetachedSigTarget;
505
507 void Init(std::string const &URIDesc, std::string const &ShortDesc);
508
509 public:
510 [[nodiscard]] std::string DescURI() const override;
511
512 // Specialized action members
513 void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
514 void Done(std::string const &Message, HashStringList const &Hashes,
515 pkgAcquire::MethodConfig const *Cnf) override;
516
518 pkgAcqMetaIndex(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager,
519 IndexTarget const &DataTarget, IndexTarget const &DetachedSigTarget) APT_NONNULL(2, 3);
520 ~pkgAcqMetaIndex() override;
521
522 friend class pkgAcqMetaSig;
523};
524 /*}}}*/
533class APT_HIDDEN pkgAcqMetaSig final : public pkgAcqTransactionItem
534{
535 void * const d;
536
537 pkgAcqMetaIndex * const MetaIndex;
538
540 std::string MetaIndexFileSignature;
541
542 protected:
543
545 [[nodiscard]] std::string GetFinalFilename() const override;
546
547 public:
548 [[nodiscard]] bool HashesRequired() const override { return false; }
549
550 // Specialized action members
551 void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
552 void Done(std::string const &Message, HashStringList const &Hashes,
553 pkgAcquire::MethodConfig const *Cnf) override;
554 [[nodiscard]] std::string Custom600Headers() const override;
555
557 pkgAcqMetaSig(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager,
558 IndexTarget const &Target, pkgAcqMetaIndex * const MetaIndex) APT_NONNULL(2, 3, 5);
559 ~pkgAcqMetaSig() override;
560};
561 /*}}}*/
563class APT_HIDDEN pkgAcqMetaClearSig final : public pkgAcqMetaIndex
564{
565 void * const d;
566 IndexTarget const DetachedDataTarget;
567
568 public:
571 metaIndex *LastMetaIndexParser;
572
573 void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
574 [[nodiscard]] std::string Custom600Headers() const override;
575 bool VerifyDone(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
576 void Done(std::string const &Message, HashStringList const &Hashes,
577 pkgAcquire::MethodConfig const *Cnf) override;
578 void Finished() override;
579
588 void QueueIndexes(bool const verify);
589
591 pkgAcqMetaClearSig(pkgAcquire * const Owner,
592 IndexTarget const &ClearsignedTarget,
593 IndexTarget const &DetachedDataTarget,
594 IndexTarget const &DetachedSigTarget,
595 metaIndex * const MetaIndexParser);
596 ~pkgAcqMetaClearSig() override;
597};
598 /*}}}*/
600class APT_HIDDEN pkgAcqBaseIndex : public pkgAcqTransactionItem
601{
602 void * const d;
603
604 public:
606 [[nodiscard]] std::string GetFinalFilename() const override;
607 void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
608
609 pkgAcqBaseIndex(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager,
610 IndexTarget const &Target) APT_NONNULL(2, 3);
611 ~pkgAcqBaseIndex() override;
612};
613 /*}}}*/
621class APT_HIDDEN pkgAcqIndex : public pkgAcqBaseIndex
622{
623 void * const d;
624
625 protected:
626
633 STAGE_DOWNLOAD,
634 STAGE_DECOMPRESS_AND_VERIFY,
635 };
636 AllStages Stage;
637
639 void StageDownloadDone(std::string const &Message);
640
644 void StageDecompressDone();
645
649 std::string EraseFileName;
650
655
658
661
663 [[nodiscard]] std::string GetFinalFilename() const override;
664
665 bool TransactionState(TransactionStates state) override;
666
667 public:
668 // Specialized action members
669 void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
670 void Done(std::string const &Message, HashStringList const &Hashes,
671 pkgAcquire::MethodConfig const *Cnf) override;
672 [[nodiscard]] std::string Custom600Headers() const override;
673 [[nodiscard]] std::string DescURI() const override { return Desc.URI; };
674 [[nodiscard]] std::string GetMetaKey() const override;
675
676 pkgAcqIndex(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager,
677 IndexTarget const &Target, bool const Derived = false) APT_NONNULL(2, 3);
678 ~pkgAcqIndex() override;
679
680 protected:
681 APT_HIDDEN void Init(std::string const &URI, std::string const &URIDesc,
682 std::string const &ShortDesc);
683 APT_HIDDEN bool CommonFailed(std::string const &TargetURI,
684 std::string const &Message, pkgAcquire::MethodConfig const *const Cnf);
685};
686 /*}}}*/
700 /*}}}*/
710class APT_HIDDEN pkgAcqDiffIndex final : public pkgAcqIndex
711{
712 void * const d;
713 std::vector<pkgAcqIndexMergeDiffs*> * diffs;
714 std::vector<DiffInfo> available_patches;
715 bool pdiff_merge;
716
717 protected:
719 bool Debug;
720
722 [[nodiscard]] std::string GetFinalFilename() const override;
723
724 bool QueueURI(pkgAcquire::ItemDesc &Item) override;
725
726 bool TransactionState(TransactionStates state) override;
727
728 public:
729 // Specialized action members
730 void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
731 bool VerifyDone(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
732 void Done(std::string const &Message, HashStringList const &Hashes,
733 pkgAcquire::MethodConfig const *Cnf) override;
734 [[nodiscard]] std::string DescURI() const override { return Target.URI + "Index"; };
735 [[nodiscard]] std::string GetMetaKey() const override;
736
747 bool ParseDiffIndex(std::string const &IndexDiffFile);
748
759 pkgAcqDiffIndex(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager,
760 IndexTarget const &Target) APT_NONNULL(2, 3);
761 ~pkgAcqDiffIndex() override;
762 private:
763 APT_HIDDEN void QueueOnIMSHit() const;
764};
765 /*}}}*/
777class APT_HIDDEN pkgAcqIndexMergeDiffs final : public pkgAcqBaseIndex
778{
779 protected:
780
784 bool Debug;
785
787 struct DiffInfo const patch;
788
790 std::vector<pkgAcqIndexMergeDiffs*> const * const allPatches;
791
794 {
797
800
803
805 StateErrorDiff
806 } State;
807
808 public:
814 void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
815 void Done(std::string const &Message, HashStringList const &Hashes,
816 pkgAcquire::MethodConfig const *Cnf) override;
817 [[nodiscard]] std::string Custom600Headers() const override;
818 [[nodiscard]] std::string DescURI() const override { return Target.URI + "Index"; };
819 [[nodiscard]] HashStringList GetExpectedHashes() const override;
820 [[nodiscard]] bool HashesRequired() const override;
821 [[nodiscard]] bool AcquireByHash() const override;
822
835 pkgAcqIndexMergeDiffs(pkgAcquire *const Owner, pkgAcqMetaClearSig *const TransactionManager,
836 IndexTarget const &Target, DiffInfo const &patch,
837 std::vector<pkgAcqIndexMergeDiffs *> const *const allPatches) APT_NONNULL(2, 3, 6);
838 ~pkgAcqIndexMergeDiffs() override;
839};
840 /*}}}*/
852class APT_HIDDEN pkgAcqIndexDiffs final : public pkgAcqBaseIndex
853{
854 private:
855
865 APT_HIDDEN bool QueueNextDiff();
866
878 APT_HIDDEN void Finish(bool const allDone=false);
879
880 protected:
881
885 bool Debug;
886
895 std::vector<DiffInfo> available_patches;
896
899 {
902
904 StateApplyDiff
905 } State;
906
907 public:
908
914 void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
915
916 void Done(std::string const &Message, HashStringList const &Hashes,
917 pkgAcquire::MethodConfig const * Cnf) override;
918 [[nodiscard]] std::string Custom600Headers() const override;
919 [[nodiscard]] std::string DescURI() const override { return Target.URI + "IndexDiffs"; };
920 [[nodiscard]] HashStringList GetExpectedHashes() const override;
921 [[nodiscard]] bool HashesRequired() const override;
922 [[nodiscard]] bool AcquireByHash() const override;
923
937 pkgAcqIndexDiffs(pkgAcquire *const Owner, pkgAcqMetaClearSig *const TransactionManager,
938 IndexTarget const &Target,
939 std::vector<DiffInfo> const &diffs = std::vector<DiffInfo>()) APT_NONNULL(2, 3);
940 ~pkgAcqIndexDiffs() override;
941};
942 /*}}}*/
948class APT_PUBLIC pkgAcqArchive : public pkgAcquire::Item
949{
950 void * const d;
951
952 bool LocalSource;
953 HashStringList ExpectedHashes;
954
955 protected:
957 pkgCache::VerIterator Version;
958
963
968
972 std::string &StoreFilename;
973
978
980 bool QueueNext();
981
983 [[nodiscard]] std::string GetFinalFilename() const override;
984
985 public:
986 void Failed(std::string const &Message, pkgAcquire::MethodConfig const * Cnf) override;
987 void Done(std::string const &Message, HashStringList const &Hashes,
988 pkgAcquire::MethodConfig const *Cnf) override;
989 [[nodiscard]] std::string DescURI() const override;
990 [[nodiscard]] std::string ShortDesc() const override;
991 void Finished() override;
992 [[nodiscard]] bool IsTrusted() const override;
993 [[nodiscard]] HashStringList GetExpectedHashes() const override;
994 [[nodiscard]] bool HashesRequired() const override;
995
1014 pkgAcqArchive(pkgAcquire * const Owner,pkgSourceList * const Sources,
1015 pkgRecords * const Recs,pkgCache::VerIterator const &Version,
1016 std::string &StoreFilename);
1017 ~pkgAcqArchive() override;
1018};
1019 /*}}}*/
1025class APT_PUBLIC pkgAcqChangelog : public pkgAcquire::Item
1026{
1027 class Private;
1028 Private * const d;
1029 std::string TemporaryDirectory;
1030 std::string const SrcName;
1031 std::string const SrcVersion;
1032
1033 public:
1034 // we will never have hashes for changelogs.
1035 // If you need verified ones, download the deb and extract the changelog.
1036 [[nodiscard]] HashStringList GetExpectedHashes() const override { return {}; }
1037 [[nodiscard]] bool HashesRequired() const override { return false; }
1038
1039 // Specialized action members
1040 void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
1041 void Done(std::string const &Message, HashStringList const &CalcHashes,
1042 pkgAcquire::MethodConfig const *Cnf) override;
1043 [[nodiscard]] std::string DescURI() const override { return Desc.URI; };
1044
1050 static std::string URI(pkgCache::VerIterator const &Ver);
1051
1060 static std::string URI(pkgCache::RlsFileIterator const &Rls,
1061 char const * const Component, char const * const SrcName,
1062 char const * const SrcVersion);
1063
1072 static std::string URI(std::string const &Template,
1073 char const * const Component, char const * const SrcName,
1074 char const * const SrcVersion);
1075
1081 static std::string URITemplate(pkgCache::RlsFileIterator const &Rls);
1082
1093 pkgAcqChangelog(pkgAcquire * const Owner, pkgCache::VerIterator const &Ver,
1094 std::string const &DestDir="", std::string const &DestFilename="");
1095
1109 pkgAcqChangelog(pkgAcquire * const Owner, pkgCache::RlsFileIterator const &Rls,
1110 char const * const Component, char const * const SrcName, char const * const SrcVersion,
1111 std::string const &DestDir="", std::string const &DestFilename="");
1112
1125 pkgAcqChangelog(pkgAcquire * const Owner, std::string const &URI,
1126 char const * const SrcName, char const * const SrcVersion,
1127 std::string const &DestDir="", std::string const &DestFilename="");
1128
1129 ~pkgAcqChangelog() override;
1130
1131private:
1132 APT_HIDDEN void Init(std::string const &DestDir, std::string const &DestFilename);
1133};
1134 /*}}}*/
1141class APT_PUBLIC pkgAcqFile : public pkgAcquire::Item
1142{
1143 void * const d;
1144
1146 bool IsIndexFile;
1147
1148 HashStringList const ExpectedHashes;
1149 public:
1150 [[nodiscard]] HashStringList GetExpectedHashes() const override;
1151 [[nodiscard]] bool HashesRequired() const override;
1152
1153 // Specialized action members
1154 void Done(std::string const &Message, HashStringList const &CalcHashes,
1155 pkgAcquire::MethodConfig const *Cnf) override;
1156 [[nodiscard]] std::string DescURI() const override { return Desc.URI; };
1157 [[nodiscard]] std::string Custom600Headers() const override;
1158
1190 pkgAcqFile(pkgAcquire * const Owner, std::string const &URI, HashStringList const &Hashes, unsigned long long const Size,
1191 std::string const &Desc, std::string const &ShortDesc,
1192 std::string const &DestDir="", std::string const &DestFilename="",
1193 bool const IsIndexFile=false);
1194 ~pkgAcqFile() override;
1195};
1196 /*}}}*/
1197class APT_HIDDEN pkgAcqAuxFile final : public pkgAcqFile /*{{{*/
1198{
1199 pkgAcquire::Item *const Owner;
1200 pkgAcquire::Worker *const Worker;
1201 unsigned long long MaximumSize;
1202
1203 public:
1204 void Failed(std::string const &Message, pkgAcquire::MethodConfig const * Cnf) override;
1205 void Done(std::string const &Message, HashStringList const &CalcHashes,
1206 pkgAcquire::MethodConfig const *Cnf) override;
1207 [[nodiscard]] std::string Custom600Headers() const override;
1208 void Finished() override;
1209
1210 pkgAcqAuxFile(pkgAcquire::Item *const Owner, pkgAcquire::Worker *const Worker,
1211 std::string const &ShortDesc, std::string const &Desc, std::string const &URI,
1212 HashStringList const &Hashes, unsigned long long const MaximumSize);
1213 ~pkgAcqAuxFile() override;
1214};
1215 /*}}}*/
1218#endif
Definition hashes.h:79
Definition hashes.h:184
Information about an index file.
Definition indexfile.h:39
std::string URI
A URI from which the index file can be downloaded.
Definition indexfile.h:42
Definition strutl.h:220
Definition weakptr.h:34
Definition metaindex.h:21
An item that is responsible for fetching a package file. {{{.
Definition acquire-item.h:949
pkgRecords * Recs
A package records object, used to look up the file corresponding to each version of the package.
Definition acquire-item.h:967
pkgCache::VerIterator Version
The package version being fetched.
Definition acquire-item.h:957
bool Trusted
true if this version file is being downloaded from a trusted source.
Definition acquire-item.h:977
std::string & StoreFilename
A location in which the actual filename of the package should be stored.
Definition acquire-item.h:972
pkgSourceList * Sources
The list of sources from which to pick archives to download this package from.
Definition acquire-item.h:962
Definition acquire-item.h:1198
Common base class for all classes that deal with fetching indexes {{{.
Definition acquire-item.h:601
Definition acquire-item.cc:3640
Retrieve the changelog for the given version {{{.
Definition acquire-item.h:1026
An item that is responsible for fetching an index file of {{{ package list diffs and starting the pac...
Definition acquire-item.h:711
bool Debug
If true, debugging information will be written to std::clog.
Definition acquire-item.h:719
Retrieve an arbitrary file to the current directory. {{{.
Definition acquire-item.h:1142
An item that is responsible for fetching server-merge patches {{{ that need to be applied to a given ...
Definition acquire-item.h:853
std::vector< DiffInfo > available_patches
Definition acquire-item.h:895
DiffState
Definition acquire-item.h:899
@ StateFetchDiff
The diff is currently being fetched.
Definition acquire-item.h:901
bool Debug
If true, debugging output will be written to std::clog.
Definition acquire-item.h:885
An item that is responsible for fetching client-merge patches {{{ that need to be applied to a given ...
Definition acquire-item.h:778
std::vector< pkgAcqIndexMergeDiffs * > const *const allPatches
list of all download items for the patches
Definition acquire-item.h:790
DiffState
Definition acquire-item.h:794
@ StateApplyDiff
The diff is currently being applied.
Definition acquire-item.h:799
@ StateFetchDiff
The diff is currently being fetched.
Definition acquire-item.h:796
@ StateDoneDiff
the work with this diff is done
Definition acquire-item.h:802
bool Debug
If true, debugging output will be written to std::clog.
Definition acquire-item.h:784
An acquire item that is responsible for fetching an index {{{ file (e.g., Packages or Sources).
Definition acquire-item.h:622
std::string CompressionExtensions
The compression-related file extensions that are being added to the downloaded file one by one if fir...
Definition acquire-item.h:654
void InitByHashIfNeeded()
Do the changes needed to fetch via AptByHash (if needed)
std::string CurrentCompressionExtension
The actual compression extension currently used.
Definition acquire-item.h:657
AllStages
The stages the method goes through.
Definition acquire-item.h:632
std::string EraseFileName
If set, this partially downloaded file will be removed when the download completes.
Definition acquire-item.h:649
the manager of a transaction
Definition acquire-item.h:408
bool AuthPass
If true, the index's signature is currently being verified.
Definition acquire-item.h:415
An item responsible for downloading clearsigned metaindexes {{{.
Definition acquire-item.h:564
metaIndex * MetaIndexParser
A package-system-specific parser for the meta-index file.
Definition acquire-item.h:570
An item that is responsible for downloading the meta-index {{{ file (i.e., Release) itself and verify...
Definition acquire-item.h:501
void Init(std::string const &URIDesc, std::string const &ShortDesc)
delayed constructor
An acquire item that downloads the detached signature {{{ of a meta-index (Release) file,...
Definition acquire-item.h:534
baseclass for the indexes files to manage them all together
Definition acquire-item.h:370
pkgAcqMetaClearSig *const TransactionManager
TransactionManager.
Definition acquire-item.h:384
std::string PartialFile
storge name until a transaction is finished
Definition acquire-item.h:381
Represents the process by which a pkgAcquire object should retrieve a file or a collection of files.
Definition acquire-item.h:59
virtual bool HashesRequired() const
Definition acquire-item.h:270
bool RenameOnError(RenameOnErrorState const state)
Rename failed file and set error.
int APT_HIDDEN Priority()
The priority of the item, used for queuing.
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 wan...
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.
unsigned int QueueCounter
The number of fetch queues into which this item has been inserted.
Definition acquire-item.h:138
std::string HashSum() const
virtual void Finished()
Invoked by the worker when the download is completely done.
unsigned long long PartialSize
How much of the object was already fetched.
Definition acquire-item.h:99
unsigned int Retries
Number of retries.
Definition acquire-item.h:156
virtual bool QueueURI(ItemDesc &Item)
Insert this item into its owner's queue.
virtual void Start(std::string const &Message, unsigned long long const Size)
Invoked when the worker starts to fetch this object.
unsigned int ExpectedAdditionalItems
The number of additional fetch items that are expected once this item is done.
Definition acquire-item.h:148
std::string ActiveSubprocess
contains the name of the subprocess that is operating on this object (for instance,...
Definition acquire-item.h:104
pkgAcquire::ItemDesc Desc
The item that is currently being downloaded.
Definition acquire-item.h:313
virtual std::string Custom600Headers() const
Custom headers to be sent to the fetch process.
void Dequeue()
Remove this item from its owner's queue.
virtual ~Item()
Remove this item from its owner's queue by invoking pkgAcquire::Remove.
bool Rename(std::string const &From, std::string const &To)
Rename a file without modifying its timestamp.
unsigned long ID
A client-supplied unique identifier.
Definition acquire-item.h:113
void APT_HIDDEN FetchAfter(time_point FetchAfter)
internal clock definitions to avoid typing all that all over the place
virtual void Failed(std::string const &Message, pkgAcquire::MethodConfig const *const Cnf)
Invoked by the acquire worker when the object couldn't be fetched.
unsigned long long FileSize
The size of the object to fetch.
Definition acquire-item.h:96
bool Complete
If true, the entire object has been successfully fetched.
Definition acquire-item.h:119
virtual std::string ShortDesc() const
Short item description.
virtual HashStringList GetExpectedHashes() const =0
bool Local
If true, the URI of this object is "local".
Definition acquire-item.h:126
virtual std::string GetFinalFilename() const
Get the full pathname of the final file for the current URI.
Item(pkgAcquire *const Owner)
Initialize an item.
std::string ErrorText
Contains a textual description of the error encountered if ItemState is StatError or StatAuthError.
Definition acquire-item.h:93
std::string DestFile
The name of the file into which the retrieved object will be written.
Definition acquire-item.h:153
virtual bool IsTrusted() const
ItemState
The current status of this item.
Definition acquire-item.h:64
@ StatAuthError
The item was downloaded but its authenticity could not be verified.
Definition acquire-item.h:82
@ StatFetching
The item is currently being downloaded.
Definition acquire-item.h:69
@ StatTransientNetworkError
The item was could not be downloaded because of a transient network error (e.g. network down)
Definition acquire-item.h:87
@ StatError
An error was encountered while downloading this item.
Definition acquire-item.h:77
@ StatDone
The item has been successfully downloaded.
Definition acquire-item.h:72
@ StatIdle
The item is waiting to be downloaded.
Definition acquire-item.h:66
pkgAcquire *const Owner
The acquire object with which this item is associated.
Definition acquire-item.h:310
virtual std::string DescURI() const =0
A "descriptive" URI-like string.
void SetActiveSubprocess(std::string const &subprocess)
Set the name of the current active subprocess.
pkgAcquire * GetOwner() const
Definition pkgrecords.h:28
Definition sourcelist.h:43
pkgCache - Structure definitions for the cache file
Definition acquire-item.h:687
HashStringList patch_hashes
Definition acquire-item.h:695
HashStringList result_hashes
Definition acquire-item.h:692
HashStringList download_hashes
Definition acquire-item.h:698
std::string file
Definition acquire-item.h:689