66 #ifndef PKGLIB_ACQUIRE_H
67 #define PKGLIB_ACQUIRE_H
69 #include <apt-pkg/macros.h>
70 #include <apt-pkg/weakptr.h>
78 #ifndef APT_8_CLEANER_HEADERS
111 typedef std::vector<Item *>::iterator ItemIterator;
112 typedef std::vector<Item *>::const_iterator ItemCIterator;
222 virtual void SetFds(
int &Fd,fd_set *RSet,fd_set *WSet);
234 virtual void RunFds(fd_set *RSet,fd_set *WSet);
323 bool Clean(std::string Dir);
563 inline void operator ++() {operator ++(0);};
565 void operator ++(
int)
567 CurItem = CurItem->
Next;
568 while (CurItem == 0 && CurQ != 0)
570 CurItem = CurQ->
Items;
576 inline bool operator !=(
UriIterator const &rhs)
const {
return rhs.CurQ != CurQ || rhs.CurItem != CurItem;};
577 inline bool operator ==(
UriIterator const &rhs)
const {
return rhs.CurQ == CurQ && rhs.CurItem == CurItem;};
585 while (CurItem == 0 && CurQ != 0)
587 CurItem = CurQ->
Items;
733 virtual void Fetched(
unsigned long long Size,
unsigned long long ResumePoint);
752 virtual bool MediaChange(std::string Media,std::string Drive) = 0;
785 virtual void Start();
std::string Name
The name of this queue.
Definition: acquire.h:424
Queue * Queues
The head of the list of active queues.
Definition: acquire.h:128
void Dequeue(Item *Item)
Remove all fetch requests for this item from all queues.
Definition: acquire.cc:243
pkgAcquire * Owner
the download scheduler with which this queue is associated.
Definition: acquire.h:444
std::string URI
The URI from which to download this item.
Definition: acquire.h:376
void operator=(pkgAcquire::ItemDesc const &I)
Assign the ItemDesc portion of this QItem from another ItemDesc.
Definition: acquire.h:414
Generate a single queue for each protocol; serialize downloads from multiple hosts.
Definition: acquire.h:166
unsigned long CurrentItems
The number of items that have been successfully downloaded.
Definition: acquire.h:710
Represents a single download source from which an item should be downloaded.
Definition: acquire.h:373
unsigned long long FetchNeeded()
Definition: acquire.cc:534
bool const Debug
If true, debugging information will be dumped to std::clog.
Definition: acquire.h:169
virtual void Stop()
Invoked when the Acquire process stops running.
Definition: acquire.cc:932
bool NeedsCleanup
If true, the subprocess has to carry out some cleanup actions before shutting down.
Definition: acquire.h:637
Queue(std::string Name, pkgAcquire *Owner)
Create a new Queue.
Definition: acquire.cc:587
Some files failed to download.
Definition: acquire.h:260
bool Startup()
Start the worker process associated with this queue.
Definition: acquire.cc:670
bool Pipeline
If true, this method supports pipelined downloading.
Definition: acquire.h:618
std::vector< Item * > Items
A list of items to download.
Definition: acquire.h:121
RunResult
Provides information on how a download terminated.
Definition: acquire.h:255
void Bump()
Check for idle queues with ready-to-fetch items.
Definition: acquire.cc:459
Iterates over all the URIs being fetched by a pkgAcquire object. {{{.
Definition: acquire.h:551
Generate one queue for each protocol/host combination; downloads from multiple hosts can proceed in p...
Definition: acquire.h:162
virtual ~Queue()
Definition: acquire.cc:600
QueueStrategy
Represents the queuing strategy for remote URIs.
Definition: acquire.h:158
bool Clean(std::string Dir)
Definition: acquire.cc:477
All files were fetched successfully.
Definition: acquire.h:257
bool Update
If true, the download scheduler should call Pulse() at the next available opportunity.
Definition: acquire.h:717
Worker * Workers
The head of the list of active workers.
Definition: acquire.h:135
QItem * FindItem(std::string URI, pkgAcquire::Worker *Owner)
Locate an item in this queue.
Definition: acquire.cc:723
unsigned long long CurrentCPS
The current rate of download as of the most recent call to pkgAcquireStatus::Pulse, in bytes per second.
Definition: acquire.h:678
bool LocalOnly
If true, this fetch method does not require network access; all files are to be acquired from the loc...
Definition: acquire.h:629
The core download scheduler. {{{.
Definition: acquire.h:93
virtual void SetFds(int &Fd, fd_set *RSet, fd_set *WSet)
Build up the set of file descriptors upon which select() should block.
Definition: acquire.cc:340
bool Shutdown(bool Final)
Shut down the worker process associated with this queue.
Definition: acquire.cc:700
void Shutdown()
Remove all items from this download process, terminate all download workers, and empty all queues...
Definition: acquire.cc:119
std::string QueueName(std::string URI, MethodConfig const *&Config)
Determine the fetch method and queue of a URI.
Definition: acquire.cc:269
UriIterator(pkgAcquire::Queue *Q)
Create a new UriIterator.
Definition: acquire.h:583
ItemIterator ItemsEnd()
Get the end iterator of the list of items.
Definition: acquire.h:302
void Bump()
Check for items that could be enqueued.
Definition: acquire.cc:790
std::string Access
The name of this acquire method (e.g., http).
Definition: acquire.h:607
virtual void Done(pkgAcquire::ItemDesc &)
Invoked when an item is successfully and completely fetched.
Definition: acquire.h:765
A monitor object for downloads controlled by the pkgAcquire class. {{{.
Definition: acquire.h:657
virtual void Start()
Invoked when the Acquire process starts running.
Definition: acquire.cc:915
bool ItemDone(QItem *Itm)
Remove the given item from this queue and set its state to pkgAcquire::Item::StatDone.
Definition: acquire.cc:736
struct timeval Time
The last time at which this monitor object was updated.
Definition: acquire.h:665
unsigned long long ElapsedTime
The amount of time that has elapsed since the download started.
Definition: acquire.h:700
bool SendConfig
If true, the worker process should send the entire APT configuration tree to the fetch subprocess whe...
Definition: acquire.h:624
virtual void Fail(pkgAcquire::ItemDesc &)
Invoked when the process of fetching an item encounters a fatal error.
Definition: acquire.h:770
bool Dequeue(Item *Owner)
Remove all fetch requests for the given item from this queue.
Definition: acquire.cc:641
unsigned long long PartialPresent()
Definition: acquire.cc:546
void Remove(Item *Item)
Remove the given item from the list of items.
Definition: acquire.cc:148
pkgAcquire::Worker * Worker
The worker associated with this item, if any.
Definition: acquire.h:409
virtual void Fetch(pkgAcquire::ItemDesc &)
Invoked when some of an item's data is fetched.
Definition: acquire.h:762
Worker * WorkersBegin()
Get the first #Worker object.
Definition: acquire.h:289
virtual void RunFds(fd_set *RSet, fd_set *WSet)
Definition: acquire.cc:364
std::string Version
The implementation version of this acquire method.
Definition: acquire.h:610
pkgAcquire::Worker * Workers
The head of the list of workers associated with this queue.
Definition: acquire.h:441
std::string Description
Definition: acquire.h:378
virtual bool MediaChange(std::string Media, std::string Drive)=0
Invoked when the user should be prompted to change the inserted removable media.
The download was cancelled by the user (i.e., Log's pkgAcquireStatus::Pulse() method returned false)...
Definition: acquire.h:265
virtual void IMSHit(pkgAcquire::ItemDesc &)
Invoked when an item is confirmed to be up-to-date.
Definition: acquire.h:759
Worker * WorkerStep(Worker *I)
Advance to the next #Worker object.
Definition: acquire.cc:468
void * d
dpointer placeholder (for later in case we need it)
Definition: acquire.h:598
Item * Owner
Definition: acquire.h:382
bool SingleInstance
If true, only one download queue should be created for this method.
Definition: acquire.h:615
pkgAcquireStatus()
Initialize all counters to 0 and the time to the current time.
Definition: acquire.cc:798
unsigned long MaxPipeDepth
The maximum number of entries that this queue will attempt to download at once.
Definition: acquire.h:454
unsigned long ToFetch
The number of files which are to be fetched.
Definition: acquire.h:153
A single item placed in this queue.
Definition: acquire.h:404
QItem * Next
The next item in the queue.
Definition: acquire.h:407
bool Cycle()
Send idle items to the worker process.
Definition: acquire.cc:757
Represents the process by which a pkgAcquire object should {{{ retrieve a file or a collection of fil...
Definition: acquire-item.h:58
ItemIterator ItemsBegin()
Get the head of the list of items.
Definition: acquire.h:299
unsigned long long CurrentBytes
The number of bytes fetched as of the most recent call to pkgAcquireStatus::Pulse, including local items.
Definition: acquire.h:683
MethodConfig * Next
The next link on the acquire method list.
Definition: acquire.h:604
void Add(Item *Item)
Add the given item to the list of items.
Definition: acquire.cc:140
bool Removable
If true, this fetch method acquires files from removable media.
Definition: acquire.h:640
void Enqueue(ItemDesc &Item)
Insert the given fetch request into the appropriate queue.
Definition: acquire.cc:200
virtual void Fetched(unsigned long long Size, unsigned long long ResumePoint)
Invoked when a local or remote file has been completely fetched.
Definition: acquire.cc:953
pkgAcquireStatus * Log
The progress indicator for this download.
Definition: acquire.h:150
virtual ~pkgAcquire()
Destroy this pkgAcquire object.
Definition: acquire.cc:101
MethodConfig()
Set up the default method parameters.
Definition: acquire.cc:574
RunResult Run(int PulseInterval=500000)
Download all the items that have been Add()ed to this download process.
Definition: acquire.cc:380
signed long PipeDepth
The number of entries in this queue that are currently being downloaded.
Definition: acquire.h:449
virtual bool Pulse(pkgAcquire *Owner)
Periodically invoked while the Acquire process is underway.
Definition: acquire.cc:808
bool MorePulses
If true, extra Pulse() invocations will be performed.
Definition: acquire.h:725
UriIterator UriBegin()
Get the head of the list of enqueued item URIs.
Definition: acquire.cc:558
bool ItemStart(QItem *Itm, unsigned long long Size)
UriIterator UriEnd()
Get the end iterator of the list of enqueued item URIs.
Definition: acquire.cc:566
unsigned long TotalItems
The total number of items that need to be fetched.
Definition: acquire.h:707
unsigned long long FetchedBytes
The total number of bytes accounted for by items that were successfully fetched.
Definition: acquire.h:695
Information about the properties of a single acquire method. {{{.
Definition: acquire.h:595
A single download queue in a pkgAcquire object. {{{.
Definition: acquire.h:389
QItem * Items
The head of the list of items contained in this queue.
Definition: acquire.h:430
bool Setup(pkgAcquireStatus *Progress=NULL, std::string const &Lock="")
Delayed constructor.
Definition: acquire.cc:69
unsigned long long TotalBytes
The total number of bytes that need to be fetched.
Definition: acquire.h:690
unsigned long long LastBytes
The number of bytes fetched as of the previous call to pkgAcquireStatus::Pulse, including local items...
Definition: acquire.h:673
bool Running
If true, a download is currently in progress.
Definition: acquire.h:171
MethodConfig * Configs
The head of the list of acquire method configurations.
Definition: acquire.h:147
A fetch subprocess.
Definition: acquire-worker.h:45
unsigned long long TotalNeeded()
Definition: acquire.cc:523
MethodConfig * GetConfig(std::string Access)
Retrieve information about a fetch method by name.
Definition: acquire.cc:311
bool Enqueue(ItemDesc &Item)
Insert the given fetch request into this queue.
Definition: acquire.cc:615
std::string ShortDesc
Definition: acquire.h:380
struct timeval StartTime
The time at which the download started.
Definition: acquire.h:668