##################################################################### */
/*}}}*/
-/** \defgroup acquire Acquire system
+/** \defgroup acquire Acquire system {{{
*
* \brief The Acquire system is responsible for retrieving files from
* local or remote URIs and postprocessing them (for instance,
* once, but it is not clear what its behavior in this case is, and
* no subclass of pkgAcquire::Item seems to actually use this
* capability.
- */
+ */ /*}}}*/
/** \addtogroup acquire
*
#ifndef PKGLIB_ACQUIRE_H
#define PKGLIB_ACQUIRE_H
+#include <apt-pkg/macros.h>
+#include <apt-pkg/weakptr.h>
+
#include <vector>
#include <string>
class pkgAcquireStatus;
-/** \brief The core download scheduler.
+/** \brief The core download scheduler. {{{
*
* This class represents an ongoing download. It manages the lists
* of active and pending downloads and handles setting up and tearing
*/
class pkgAcquire
{
+ private:
+ /** \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;
+
public:
class Item;
/** \brief The progress indicator for this download. */
pkgAcquireStatus *Log;
- /** \brief The total size of the files which are to be fetched.
- *
- * This is not necessarily the total number of bytes to download
- * when, e.g., download resumption and list updates via patches
- * are taken into account.
- */
+ /** \brief The number of files which are to be fetched. */
unsigned long ToFetch;
// Configurable parameters for the scheduler
QueueAccess} QueueMode;
/** \brief If \b true, debugging information will be dumped to std::clog. */
- bool Debug;
+ bool const Debug;
/** \brief If \b true, a download is currently in progress. */
bool Running;
/** \return the total size in bytes of all the items included in
* this download.
*/
- double TotalNeeded();
+ unsigned long long TotalNeeded();
/** \return the size in bytes of all non-local items included in
* this download.
*/
- double FetchNeeded();
+ unsigned long long FetchNeeded();
/** \return the amount of data to be fetched that is already
* present on the filesystem.
*/
- double PartialPresent();
+ unsigned long long PartialPresent();
- /** \brief Construct a new pkgAcquire.
+ /** \brief Delayed constructor
*
- * \param Log The progress indicator associated with this
- * download, or \b NULL for none. This object is not owned by the
+ * \param Progress indicator associated with this download or
+ * \b NULL for none. This object is not owned by the
* download process and will not be deleted when the pkgAcquire
* object is destroyed. Naturally, it should live for at least as
* long as the pkgAcquire object does.
+ * \param Lock defines a lock file that should be acquired to ensure
+ * only one Acquire class is in action at the time or an empty string
+ * if no lock file should be used.
*/
- pkgAcquire(pkgAcquireStatus *Log = 0);
+ bool Setup(pkgAcquireStatus *Progress = NULL, string const &Lock = "");
+
+ /** \brief Construct a new pkgAcquire. */
+ pkgAcquire(pkgAcquireStatus *Log) __deprecated;
+ pkgAcquire();
/** \brief Destroy this pkgAcquire object.
*
* this download.
*/
virtual ~pkgAcquire();
+
};
/** \brief Represents a single download source from which an item
*
* An item may have several assocated ItemDescs over its lifetime.
*/
-struct pkgAcquire::ItemDesc
+struct pkgAcquire::ItemDesc : public WeakPointable
{
/** \brief The URI from which to download this item. */
string URI;
/** brief The underlying item which is to be downloaded. */
Item *Owner;
};
-
-/** \brief A single download queue in a pkgAcquire object.
+ /*}}}*/
+/** \brief A single download queue in a pkgAcquire object. {{{
*
* \todo Why so many protected values?
*/
friend class pkgAcquire::UriIterator;
friend class pkgAcquire::Worker;
+ /** \brief dpointer placeholder (for later in case we need it) */
+ void *d;
+
/** \brief The next queue in the pkgAcquire object's list of queues. */
Queue *Next;
*
* \todo Unimplemented. Implement it or remove?
*/
- bool ItemStart(QItem *Itm,unsigned long Size);
+ bool ItemStart(QItem *Itm,unsigned long long Size);
/** \brief Remove the given item from this queue and set its state
* to pkgAcquire::Item::StatDone.
/** Shut down all the worker processes associated with this queue
* and empty the queue.
*/
- ~Queue();
+ virtual ~Queue();
};
-
-/** \brief Iterates over all the URIs being fetched by a pkgAcquire object. */
+ /*}}}*/
+/** \brief Iterates over all the URIs being fetched by a pkgAcquire object. {{{*/
class pkgAcquire::UriIterator
{
+ /** \brief dpointer placeholder (for later in case we need it) */
+ void *d;
+
/** The next queue to iterate over. */
pkgAcquire::Queue *CurQ;
/** The item that we currently point at. */
public:
- inline void operator ++() {operator ++();};
+ inline void operator ++() {operator ++(0);};
void operator ++(int)
{
CurQ = CurQ->Next;
}
}
+ virtual ~UriIterator() {};
};
-
-/** \brief Information about the properties of a single acquire method. */
+ /*}}}*/
+/** \brief Information about the properties of a single acquire method. {{{*/
struct pkgAcquire::MethodConfig
{
+ /** \brief dpointer placeholder (for later in case we need it) */
+ void *d;
+
/** \brief The next link on the acquire method list.
*
* \todo Why not an STL container?
* appropriate.
*/
MethodConfig();
-};
-/** \brief A monitor object for downloads controlled by the pkgAcquire class.
+ /* \brief Destructor, empty currently */
+ virtual ~MethodConfig() {};
+};
+ /*}}}*/
+/** \brief A monitor object for downloads controlled by the pkgAcquire class. {{{
*
* \todo Why protected members?
*
*/
class pkgAcquireStatus
{
+ /** \brief dpointer placeholder (for later in case we need it) */
+ void *d;
+
protected:
/** \brief The last time at which this monitor object was updated. */
*
* \param ResumePoint How much of the file was already fetched.
*/
- virtual void Fetched(unsigned long Size,unsigned long ResumePoint);
+ virtual void Fetched(unsigned long long Size,unsigned long long ResumePoint);
/** \brief Invoked when the user should be prompted to change the
* inserted removable media.
pkgAcquireStatus();
virtual ~pkgAcquireStatus() {};
};
-
+ /*}}}*/
/** @} */
#endif