projects
/
apt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cppcheck complains about some possible speed improvements which could be
[apt.git]
/
apt-pkg
/
acquire.h
diff --git
a/apt-pkg/acquire.h
b/apt-pkg/acquire.h
index 64dafdc9d82a035ad93dcdf07ab3ababd959489d..9fe0e8a877b5175a2a2584f2cb1e26c50d6fe4d5 100644
(file)
--- a/
apt-pkg/acquire.h
+++ b/
apt-pkg/acquire.h
@@
-30,7
+30,7
@@
##################################################################### */
/*}}}*/
##################################################################### */
/*}}}*/
-/** \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,
*
* \brief The Acquire system is responsible for retrieving files from
* local or remote URIs and postprocessing them (for instance,
@@
-54,7
+54,7
@@
* 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.
* 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
*
/** \addtogroup acquire
*
@@
-66,22
+66,22
@@
#ifndef PKGLIB_ACQUIRE_H
#define PKGLIB_ACQUIRE_H
#ifndef PKGLIB_ACQUIRE_H
#define PKGLIB_ACQUIRE_H
+#include <apt-pkg/macros.h>
+#include <apt-pkg/weakptr.h>
+
#include <vector>
#include <string>
using std::vector;
using std::string;
#include <vector>
#include <string>
using std::vector;
using std::string;
-#ifdef __GNUG__
-#pragma interface "apt-pkg/acquire.h"
-#endif
#include <sys/time.h>
#include <unistd.h>
class pkgAcquireStatus;
#include <sys/time.h>
#include <unistd.h>
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
*
* This class represents an ongoing download. It manages the lists
* of active and pending downloads and handles setting up and tearing
@@
-164,7
+164,7
@@
class pkgAcquire
QueueAccess} QueueMode;
/** \brief If \b true, debugging information will be dumped to std::clog. */
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;
/** \brief If \b true, a download is currently in progress. */
bool Running;
@@
-323,27
+323,36
@@
class pkgAcquire
/** \return the total size in bytes of all the items included in
* this download.
*/
/** \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.
*/
/** \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.
*/
/** \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.
* 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 = "");
+
+ void SetLog(pkgAcquireStatus *Progress) { Log = Progress; }
+
+ /** \brief Construct a new pkgAcquire. */
+ pkgAcquire(pkgAcquireStatus *Log) __deprecated;
+ pkgAcquire();
/** \brief Destroy this pkgAcquire object.
*
/** \brief Destroy this pkgAcquire object.
*
@@
-351,6
+360,10
@@
class pkgAcquire
* this download.
*/
virtual ~pkgAcquire();
* this download.
*/
virtual ~pkgAcquire();
+
+ private:
+ /** \brief FD of the Lock file we acquire in Setup (if any) */
+ int LockFD;
};
/** \brief Represents a single download source from which an item
};
/** \brief Represents a single download source from which an item
@@
-358,7
+371,7
@@
class pkgAcquire
*
* An item may have several assocated ItemDescs over its lifetime.
*/
*
* 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 URI from which to download this item. */
string URI;
@@
-369,8
+382,8
@@
struct pkgAcquire::ItemDesc
/** brief The underlying item which is to be downloaded. */
Item *Owner;
};
/** 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?
*/
*
* \todo Why so many protected values?
*/
@@
-440,8
+453,12
@@
class pkgAcquire::Queue
public:
public:
- /** \brief Insert the given fetch request into this queue. */
- void Enqueue(ItemDesc &Item);
+ /** \brief Insert the given fetch request into this queue.
+ *
+ * \return \b true if the queuing was successful. May return
+ * \b false if the Item is already in the queue
+ */
+ bool Enqueue(ItemDesc &Item);
/** \brief Remove all fetch requests for the given item from this queue.
*
/** \brief Remove all fetch requests for the given item from this queue.
*
@@
-527,8
+544,8
@@
class pkgAcquire::Queue
*/
~Queue();
};
*/
~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
{
/** The next queue to iterate over. */
class pkgAcquire::UriIterator
{
/** The next queue to iterate over. */
@@
-538,7
+555,7
@@
class pkgAcquire::UriIterator
public:
public:
- inline void operator ++() {operator ++();};
+ inline void operator ++() {operator ++(
0
);};
void operator ++(int)
{
void operator ++(int)
{
@@
-567,8
+584,8
@@
class pkgAcquire::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 The next link on the acquire method list.
struct pkgAcquire::MethodConfig
{
/** \brief The next link on the acquire method list.
@@
-620,8
+637,8
@@
struct pkgAcquire::MethodConfig
*/
MethodConfig();
};
*/
MethodConfig();
};
-
-/** \brief A monitor object for downloads controlled by the pkgAcquire class.
+ /*}}}*/
+/** \brief A monitor object for downloads controlled by the pkgAcquire class.
{{{
*
* \todo Why protected members?
*
*
* \todo Why protected members?
*
@@
-761,7
+778,7
@@
class pkgAcquireStatus
pkgAcquireStatus();
virtual ~pkgAcquireStatus() {};
};
pkgAcquireStatus();
virtual ~pkgAcquireStatus() {};
};
-
+ /*}}}*/
/** @} */
#endif
/** @} */
#endif