- pkgAcqIndexDiffs(pkgAcquire *Owner,
- pkgAcqMetaBase *TransactionManager,
- struct IndexTarget const * const Target,
- HashStringList const &ExpectedHash,
- indexRecords *MetaIndexParser,
- std::string ServerSha1,
- std::vector<DiffInfo> diffs=std::vector<DiffInfo>());
-};
- /*}}}*/
-/** \brief An acquire item that is responsible for fetching an index {{{
- * file (e.g., Packages or Sources).
- *
- * \sa pkgAcqDiffIndex, pkgAcqIndexDiffs, pkgAcqIndexTrans
- *
- * \todo Why does pkgAcqIndex have protected members?
- */
-class pkgAcqIndex : public pkgAcqBaseIndex
-{
- void *d;
-
- protected:
-
- /** \brief The stages the method goes through
- *
- * The method first downloads the indexfile, then its decompressed (or
- * copied) and verified
- */
- enum AllStages {
- STAGE_DOWNLOAD,
- STAGE_DECOMPRESS_AND_VERIFY,
- };
- AllStages Stage;
-
- /** \brief Handle what needs to be done when the download is done */
- void StageDownloadDone(std::string Message,
- HashStringList const &Hashes,
- pkgAcquire::MethodConfig *Cfg);
-
- /** \brief Handle what needs to be done when the decompression/copy is
- * done
- */
- void StageDecompressDone(std::string Message,
- HashStringList const &Hashes,
- pkgAcquire::MethodConfig *Cfg);
-
- /** \brief If \b set, this partially downloaded file will be
- * removed when the download completes.
- */
- std::string EraseFileName;
-
- /** \brief The compression-related file extensions that are being
- * added to the downloaded file one by one if first fails (e.g., "gz bz2").
- */
- std::string CompressionExtensions;
-
- /** \brief The actual compression extension currently used */
- std::string CurrentCompressionExtension;
-
- /** \brief Do the changes needed to fetch via AptByHash (if needed) */
- void InitByHashIfNeeded(const std::string MetaKey);
-
- /** \brief Auto select the right compression to use */
- void AutoSelectCompression();
-
- /** \brief Get the full pathname of the final file for the current URI
- */
- std::string GetFinalFilename() const;
-
- /** \brief Schedule file for verification after a IMS hit */
- void ReverifyAfterIMS();
-
- /** \brief Validate the downloaded index file */
- bool ValidateFile(const std::string &FileName);
-
- public:
-
- // Specialized action members
- virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
- virtual void Done(std::string Message,unsigned long long Size,
- HashStringList const &Hashes,
- pkgAcquire::MethodConfig *Cnf);
- virtual std::string Custom600Headers() const;
- virtual std::string DescURI() {return Desc.URI;};
-
- /** \brief Create a pkgAcqIndex.
- *
- * \param Owner The pkgAcquire object with which this item is
- * associated.
- *
- * \param URI The URI of the index file that is to be downloaded.
- *
- * \param URIDesc A "URI-style" description of this index file.
- *
- * \param ShortDesc A brief description of this index file.
- *
- * \param ExpectedHashes The expected hashsum of this index file.
- *
- * \param compressExt The compression-related extension with which
- * this index file should be downloaded, or "" to autodetect
- * Compression types can be set with config Acquire::CompressionTypes,
- * default is ".lzma" or ".bz2" (if the needed binaries are present)
- * fallback is ".gz" or none.
- */
- pkgAcqIndex(pkgAcquire *Owner,std::string URI,std::string URIDesc,
- std::string ShortDesc, HashStringList const &ExpectedHashes);
- pkgAcqIndex(pkgAcquire *Owner, pkgAcqMetaBase *TransactionManager,
- IndexTarget const * const Target,
- HashStringList const &ExpectedHash,
- indexRecords *MetaIndexParser);
-
- void Init(std::string const &URI, std::string const &URIDesc,
- std::string const &ShortDesc);
-};
- /*}}}*/
-/** \brief An acquire item that is responsible for fetching a {{{
- * translated index file.
- *
- * The only difference from pkgAcqIndex is that transient failures
- * are suppressed: no error occurs if the translated index file is
- * missing.
- */
-class pkgAcqIndexTrans : public pkgAcqIndex
-{
- void *d;
-
- public:
-
- virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
- virtual std::string Custom600Headers() const;
-
- /** \brief Create a pkgAcqIndexTrans.
- *
- * \param Owner The pkgAcquire object with which this item is
- * associated.
- *
- * \param URI The URI of the index file that is to be downloaded.
- *
- * \param URIDesc A "URI-style" description of this index file.
- *
- * \param ShortDesc A brief description of this index file.
- */
- pkgAcqIndexTrans(pkgAcquire *Owner,
- std::string URI,std::string URIDesc,
- std::string ShortDesc);
- pkgAcqIndexTrans(pkgAcquire *Owner,
- pkgAcqMetaBase *TransactionManager,
- IndexTarget const * const Target,
- HashStringList const &ExpectedHashes,
- indexRecords *MetaIndexParser);
-};
- /*}}}*/
-/** \brief Information about an index file. */ /*{{{*/
-class IndexTarget
-{
- void *d;
-
- public:
- /** \brief A URI from which the index file can be downloaded. */
- std::string URI;
-
- /** \brief A description of the index file. */
- std::string Description;
-
- /** \brief A shorter description of the index file. */
- std::string ShortDesc;
-
- /** \brief The key by which this index file should be
- * looked up within the meta signature file.
- */
- std::string MetaKey;
-
- virtual bool IsOptional() const {
- return false;
- }
-};
- /*}}}*/
-/** \brief Information about an optional index file. */ /*{{{*/
-class OptionalIndexTarget : public IndexTarget
-{
- void *d;
-
- virtual bool IsOptional() const {
- return true;
- }