X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/862bafea48af2ceaf96345db237b461307a021f6..91e42c2b4e9a6e8c7c1db29e9d1606741d251ca0:/apt-pkg/acquire.h diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index a1a192d5f..0d2b21233 100644 --- a/apt-pkg/acquire.h +++ b/apt-pkg/acquire.h @@ -1,6 +1,5 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire.h,v 1.29.2.1 2003/12/24 23:09:17 mdz Exp $ /* ###################################################################### Acquire - File Acquiration @@ -68,9 +67,10 @@ #include #include +#include -#include #include +#include #include #include @@ -101,7 +101,7 @@ class pkgAcquire /** \brief FD of the Lock file we acquire in Setup (if any) */ int LockFD; /** \brief dpointer placeholder (for later in case we need it) */ - void *d; + void * const d; public: @@ -111,6 +111,7 @@ class pkgAcquire struct MethodConfig; struct ItemDesc; friend class Item; + friend class pkgAcqMetaBase; friend class Queue; typedef std::vector::iterator ItemIterator; @@ -368,7 +369,7 @@ class pkgAcquire bool GetLock(std::string const &Lock); /** \brief Construct a new pkgAcquire. */ - pkgAcquire(pkgAcquireStatus *Log); + explicit pkgAcquire(pkgAcquireStatus *Log); pkgAcquire(); /** \brief Destroy this pkgAcquire object. @@ -378,6 +379,8 @@ class pkgAcquire */ virtual ~pkgAcquire(); + private: + APT_HIDDEN void Initialize(); }; /** \brief Represents a single download source from which an item @@ -387,13 +390,13 @@ class pkgAcquire */ struct pkgAcquire::ItemDesc : public WeakPointable { - /** \brief The URI from which to download this item. */ + /** \brief URI from which to download this item. */ std::string URI; - /** brief A description of this item. */ + /** \brief description of this item. */ std::string Description; - /** brief A shorter description of this item. */ + /** \brief shorter description of this item. */ std::string ShortDesc; - /** brief The underlying item which is to be downloaded. */ + /** \brief underlying item which is to be downloaded. */ Item *Owner; }; /*}}}*/ @@ -408,7 +411,7 @@ class pkgAcquire::Queue friend class pkgAcquire::Worker; /** \brief dpointer placeholder (for later in case we need it) */ - void *d; + void * const d; /** \brief The next queue in the pkgAcquire object's list of queues. */ Queue *Next; @@ -416,13 +419,18 @@ class pkgAcquire::Queue protected: /** \brief A single item placed in this queue. */ - struct QItem : pkgAcquire::ItemDesc + struct QItem : public ItemDesc { /** \brief The next item in the queue. */ QItem *Next; /** \brief The worker associated with this item, if any. */ pkgAcquire::Worker *Worker; + /** \brief The underlying items interested in the download */ + std::vector Owners; + + typedef std::vector::const_iterator owner_iterator; + /** \brief Assign the ItemDesc portion of this QItem from * another ItemDesc */ @@ -431,10 +439,24 @@ class pkgAcquire::Queue URI = I.URI; Description = I.Description; ShortDesc = I.ShortDesc; + Owners.clear(); + Owners.push_back(I.Owner); Owner = I.Owner; }; + + /** @return the sum of all expected hashes by all owners */ + HashStringList GetExpectedHashes() const; + + /** @return smallest maximum size of all owners */ + unsigned long long GetMaximumSize() const; + + /** \brief get partial files in order */ + void SyncDestinationFiles() const; + + /** @return the custom headers to use for this item */ + std::string Custom600Headers() const; }; - + /** \brief The name of this queue. */ std::string Name; @@ -554,7 +576,7 @@ class pkgAcquire::Queue * \param Name The name of the new queue. * \param Owner The download process that owns the new queue. */ - Queue(std::string Name,pkgAcquire *Owner); + Queue(std::string const &Name,pkgAcquire * const Owner); /** Shut down all the worker processes associated with this queue * and empty the queue. @@ -566,7 +588,7 @@ class pkgAcquire::Queue class pkgAcquire::UriIterator { /** \brief dpointer placeholder (for later in case we need it) */ - void *d; + void * const d; /** The next queue to iterate over. */ pkgAcquire::Queue *CurQ; @@ -587,7 +609,7 @@ class pkgAcquire::UriIterator } }; - inline pkgAcquire::ItemDesc const *operator ->() const {return CurItem;}; + inline pkgAcquire::Queue::QItem const *operator ->() const {return CurItem;}; inline bool operator !=(UriIterator const &rhs) const {return rhs.CurQ != CurQ || rhs.CurItem != CurItem;}; inline bool operator ==(UriIterator const &rhs) const {return rhs.CurQ == CurQ && rhs.CurItem == CurItem;}; @@ -595,14 +617,7 @@ class pkgAcquire::UriIterator * * \param Q The queue over which this UriIterator should iterate. */ - UriIterator(pkgAcquire::Queue *Q) : d(NULL), CurQ(Q), CurItem(0) - { - while (CurItem == 0 && CurQ != 0) - { - CurItem = CurQ->Items; - CurQ = CurQ->Next; - } - } + explicit UriIterator(pkgAcquire::Queue *Q); virtual ~UriIterator(); }; /*}}}*/ @@ -610,7 +625,7 @@ class pkgAcquire::UriIterator struct pkgAcquire::MethodConfig { /** \brief dpointer placeholder (for later in case we need it) */ - void *d; + void * const d; /** \brief The next link on the acquire method list. * @@ -671,7 +686,7 @@ struct pkgAcquire::MethodConfig class pkgAcquireStatus { /** \brief dpointer placeholder (for later in case we need it) */ - void *d; + void * const d; protected: