A single download queue in a pkgAcquire object. {{{. More...
#include <acquire.h>
Classes | |
struct | QItem |
A single item placed in this queue. More... | |
Public Member Functions | |
bool | Enqueue (ItemDesc &Item) |
Insert the given fetch request into this queue. | |
bool | Dequeue (Item *Owner) |
Remove all fetch requests for the given item from this queue. | |
QItem * | FindItem (string URI, pkgAcquire::Worker *Owner) |
Locate an item in this queue. | |
bool | ItemStart (QItem *Itm, unsigned long Size) |
bool | ItemDone (QItem *Itm) |
Remove the given item from this queue and set its state to pkgAcquire::Item::StatDone. | |
bool | Startup () |
Start the worker process associated with this queue. | |
bool | Shutdown (bool Final) |
Shut down the worker process associated with this queue. | |
bool | Cycle () |
Send idle items to the worker process. | |
void | Bump () |
Check for items that could be enqueued. | |
Queue (string Name, pkgAcquire *Owner) | |
Create a new Queue. | |
~Queue () | |
Protected Attributes | |
string | Name |
The name of this queue. | |
QItem * | Items |
The head of the list of items contained in this queue. | |
pkgAcquire::Worker * | Workers |
The head of the list of workers associated with this queue. | |
pkgAcquire * | Owner |
the download scheduler with which this queue is associated. | |
signed long | PipeDepth |
The number of entries in this queue that are currently being downloaded. | |
unsigned long | MaxPipeDepth |
The maximum number of entries that this queue will attempt to download at once. | |
Friends | |
class | pkgAcquire |
class | pkgAcquire::UriIterator |
class | pkgAcquire::Worker |
A single download queue in a pkgAcquire object. {{{.
Queue | ( | string | Name, | |
pkgAcquire * | Owner | |||
) |
Create a new Queue.
Name | The name of the new queue. | |
Owner | The download process that owns the new queue. |
References Items, MaxPipeDepth, PipeDepth, and Workers.
~Queue | ( | ) |
Shut down all the worker processes associated with this queue and empty the queue.
References Items, pkgAcquire::Queue::QItem::Next, and Shutdown().
void Bump | ( | ) |
Check for items that could be enqueued.
Call this after an item placed in multiple queues has gone from the pkgAcquire::Item::StatFetching state to the pkgAcquire::Item::StatIdle state, to possibly refill an empty queue. This is an alias for Cycle().
References Cycle().
bool Cycle | ( | ) |
Send idle items to the worker process.
Fills up the pipeline by inserting idle items into the worker's queue.
References Items, MaxPipeDepth, pkgAcquire::Queue::QItem::Next, pkgAcquire::ItemDesc::Owner, PipeDepth, pkgAcquire::Worker::QueueItem(), pkgAcquire::Item::StatIdle, pkgAcquire::Item::Status, pkgAcquire::Queue::QItem::Worker, and Workers.
Referenced by Bump(), Enqueue(), ItemDone(), and Startup().
bool Dequeue | ( | Item * | Owner | ) |
Remove all fetch requests for the given item from this queue.
References Items, pkgAcquire::Queue::QItem::Next, pkgAcquire::Item::QueueCounter, pkgAcquire::Item::StatFetching, and pkgAcquire::Item::Status.
Referenced by pkgAcquire::Dequeue(), and ItemDone().
bool Enqueue | ( | ItemDesc & | Item | ) |
Insert the given fetch request into this queue.
References Cycle(), Items, pkgAcquire::Queue::QItem::Next, pkgAcquire::ItemDesc::Owner, pkgAcquire::Item::QueueCounter, pkgAcquire::Item::Status, and pkgAcquire::ItemDesc::URI.
Referenced by pkgAcquire::Enqueue().
pkgAcquire::Queue::QItem * FindItem | ( | string | URI, | |
pkgAcquire::Worker * | Owner | |||
) |
Locate an item in this queue.
URI | A URI to match against. | |
Owner | A pkgAcquire::Worker to match against. |
References Items, and pkgAcquire::Queue::QItem::Next.
Referenced by pkgAcquire::Worker::RunMessages().
bool ItemDone | ( | QItem * | Itm | ) |
Remove the given item from this queue and set its state to pkgAcquire::Item::StatDone.
If this is the only queue containing the item, the item is also removed from the main queue by calling pkgAcquire::Dequeue.
Itm | The item to remove. |
References pkgAcquire::Bump(), Cycle(), Dequeue(), pkgAcquire::Dequeue(), Owner, pkgAcquire::ItemDesc::Owner, PipeDepth, pkgAcquire::Item::QueueCounter, pkgAcquire::Item::StatFetching, and pkgAcquire::Item::Status.
Referenced by pkgAcquire::Worker::RunMessages().
bool ItemStart | ( | QItem * | Itm, | |
unsigned long | Size | |||
) |
Presumably this should start downloading an item?
bool Shutdown | ( | bool | Final | ) |
Shut down the worker process associated with this queue.
Final | If true, then the process is stopped unconditionally. Otherwise, it is only stopped if it does not need cleanup as indicated by the pkgAcqMethod::NeedsCleanup member of its configuration. |
References pkgAcquire::Worker::GetConf(), pkgAcquire::MethodConfig::NeedsCleanup, pkgAcquire::Worker::NextQueue, Owner, pkgAcquire::Remove(), and Workers.
Referenced by ~Queue().
bool Startup | ( | ) |
Start the worker process associated with this queue.
If a worker process is already associated with this queue, this is equivalent to calling Cycle().
References pkgAcquire::Add(), Cycle(), pkgAcquire::GetConfig(), pkgAcquire::Log, MaxPipeDepth, Name, Owner, pkgAcquire::MethodConfig::Pipeline, pkgAcquire::Worker::Start(), and Workers.
Referenced by pkgAcquire::Enqueue().
The head of the list of items contained in this queue.
Referenced by Cycle(), Dequeue(), Enqueue(), FindItem(), Queue(), pkgAcquire::UriIterator::UriIterator(), and ~Queue().
pkgAcquire::Worker* Workers [protected] |
The head of the list of workers associated with this queue.
Referenced by Cycle(), Queue(), Shutdown(), and Startup().