summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire.h
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2015-08-18 11:57:35 +0200
committerMichael Vogt <mvo@debian.org>2015-08-18 11:57:35 +0200
commitb53c9cea2902572822bbbece5bac236c1bbf846e (patch)
tree6c6b0524e0971c0623ccbff71383523ee0b2a5cc /apt-pkg/acquire.h
parent21248c0f00ee71412dbadc6ebf84011cf974346d (diff)
parent2a22cd60f04c4291ea9b9b72e15b6d2ec378b001 (diff)
Merge remote-tracking branch 'upstream/debian/experimental' into feature/srv-records
Diffstat (limited to 'apt-pkg/acquire.h')
-rw-r--r--apt-pkg/acquire.h60
1 files changed, 36 insertions, 24 deletions
diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h
index fc90624e1..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 <apt-pkg/macros.h>
#include <apt-pkg/weakptr.h>
+#include <apt-pkg/hashes.h>
-#include <vector>
#include <string>
+#include <vector>
#include <stddef.h>
#include <sys/time.h>
@@ -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:
@@ -369,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.
@@ -390,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;
};
/*}}}*/
@@ -411,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;
@@ -419,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<Item*> Owners;
+
+ typedef std::vector<Item*>::const_iterator owner_iterator;
+
/** \brief Assign the ItemDesc portion of this QItem from
* another ItemDesc
*/
@@ -434,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;
@@ -557,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.
@@ -569,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;
@@ -590,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;};
@@ -598,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();
};
/*}}}*/
@@ -613,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.
*
@@ -674,7 +686,7 @@ struct pkgAcquire::MethodConfig
class pkgAcquireStatus
{
/** \brief dpointer placeholder (for later in case we need it) */
- void *d;
+ void * const d;
protected: