From 0b58b3f8917a49d83154fd3173bca36c1d617ef0 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 14 May 2014 17:47:20 +0200 Subject: Add new pkgAcqBaseIndex as base class for pkgAcq{DiffIndex,IndexMerge,pkgAcqBaseIndex, pkgAcqIndex} --- apt-pkg/acquire-item.h | 63 +++++++++++++++----------------------------------- 1 file changed, 19 insertions(+), 44 deletions(-) (limited to 'apt-pkg/acquire-item.h') diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index 7219e8047..35cd78afc 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -368,6 +368,9 @@ class pkgAcqSubIndex : public pkgAcquire::Item }; /*}}}*/ +/** \brief Common base class for all classes that deal with fetching {{{ + indexes + */ class pkgAcqBaseIndex : public pkgAcquire::Item { protected: @@ -376,9 +379,18 @@ class pkgAcqBaseIndex : public pkgAcquire::Item const struct IndexTarget * Target; indexRecords *MetaIndexParser; + /** \brief The Hash that this file should have after download + */ + HashString ExpectedHash; + pkgAcqBaseIndex(pkgAcquire *Owner, + struct IndexTarget const * const Target, + HashString ExpectedHash, + indexRecords *MetaIndexParser) + : Item(Owner), Target(Target), MetaIndexParser(MetaIndexParser), + ExpectedHash(ExpectedHash) {}; }; - + /*}}}*/ /** \brief An item that is responsible for fetching an index file of {{{ * package list diffs and starting the package list's download. * @@ -388,7 +400,7 @@ class pkgAcqBaseIndex : public pkgAcquire::Item * * \sa pkgAcqIndexDiffs, pkgAcqIndex */ -class pkgAcqDiffIndex : public pkgAcquire::Item +class pkgAcqDiffIndex : public pkgAcqBaseIndex { protected: /** \brief If \b true, debugging information will be written to std::clog. */ @@ -402,11 +414,6 @@ class pkgAcqDiffIndex : public pkgAcquire::Item */ std::string RealURI; - /** \brief The Hash that the real index file should have after - * all patches have been applied. - */ - HashString ExpectedHash; - /** \brief The index file which will be patched to generate the new * file. */ @@ -417,11 +424,6 @@ class pkgAcqDiffIndex : public pkgAcquire::Item */ std::string Description; - /** \brief Pointer to the IndexTarget data - */ - const struct IndexTarget * Target; - indexRecords *MetaIndexParser; - public: // Specialized action members virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf); @@ -472,7 +474,7 @@ class pkgAcqDiffIndex : public pkgAcquire::Item * * \sa pkgAcqDiffIndex, pkgAcqIndex */ -class pkgAcqIndexMergeDiffs : public pkgAcquire::Item +class pkgAcqIndexMergeDiffs : public pkgAcqBaseIndex { protected: @@ -491,11 +493,6 @@ class pkgAcqIndexMergeDiffs : public pkgAcquire::Item */ std::string RealURI; - /** \brief HashSum of the package index file that is being - * reconstructed. - */ - HashString ExpectedHash; - /** \brief description of the file being downloaded. */ std::string Description; @@ -521,11 +518,6 @@ class pkgAcqIndexMergeDiffs : public pkgAcquire::Item StateErrorDiff } State; - /** \brief Pointer to the IndexTarget data - */ - const struct IndexTarget * Target; - indexRecords *MetaIndexParser; - public: /** \brief Called when the patch file failed to be downloaded. * @@ -578,7 +570,7 @@ class pkgAcqIndexMergeDiffs : public pkgAcquire::Item * * \sa pkgAcqDiffIndex, pkgAcqIndex */ -class pkgAcqIndexDiffs : public pkgAcquire::Item +class pkgAcqIndexDiffs : public pkgAcqBaseIndex { private: @@ -623,11 +615,6 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item */ std::string RealURI; - /** \brief The HashSum of the package index file that is being - * reconstructed. - */ - HashString ExpectedHash; - /** A description of the file being downloaded. */ std::string Description; @@ -660,11 +647,6 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item StateApplyDiff } State; - /** \brief Pointer to the IndexTarget data - */ - const struct IndexTarget * Target; - indexRecords *MetaIndexParser; - public: /** \brief Called when the patch file failed to be downloaded. @@ -717,7 +699,7 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item * * \todo Why does pkgAcqIndex have protected members? */ -class pkgAcqIndex : public pkgAcquire::Item +class pkgAcqIndex : public pkgAcqBaseIndex { protected: @@ -749,19 +731,11 @@ class pkgAcqIndex : public pkgAcquire::Item */ std::string RealURI; - /** \brief The expected hashsum of the decompressed index file. */ - HashString ExpectedHash; - /** \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 CompressionExtension; - /** \brief Pointer to the IndexTarget data - */ - const struct IndexTarget * Target; - indexRecords *MetaIndexParser; - public: // Specialized action members @@ -798,7 +772,8 @@ class pkgAcqIndex : public pkgAcquire::Item struct IndexTarget const * const Target, HashString const &ExpectedHash, indexRecords *MetaIndexParser); - void Init(std::string const &URI, std::string const &URIDesc, std::string const &ShortDesc); + void Init(std::string const &URI, std::string const &URIDesc, + std::string const &ShortDesc); }; /*}}}*/ /** \brief An acquire item that is responsible for fetching a {{{ -- cgit v1.2.3