]>
git.saurik.com Git - apt.git/blob - apt-pkg/acquire.h
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: acquire.h,v 1.4 1998/10/24 04:58:02 jgg Exp $
4 /* ######################################################################
6 Acquire - File Acquiration
8 This module contians the Acquire system. It is responsible for bringing
9 files into the local pathname space. It deals with URIs for files and
10 URI handlers responsible for downloading or finding the URIs.
12 Each file to download is represented by an Acquire::Item class subclassed
13 into a specialization. The Item class can add itself to several URI
14 acquire queues each prioritized by the download scheduler. When the
15 system is run the proper URI handlers are spawned and the the acquire
16 queues are fed into the handlers by the schedular until the queues are
17 empty. This allows for an Item to be downloaded from an alternate source
18 if the first try turns out to fail. It also alows concurrent downloading
19 of multiple items from multiple sources as well as dynamic balancing
20 of load between the sources.
22 Schedualing of downloads is done on a first ask first get basis. This
23 preserves the order of the download as much as possible. And means the
24 fastest source will tend to process the largest number of files.
26 Internal methods and queues for performing gzip decompression,
27 md5sum hashing and file copying are provided to allow items to apply
28 a number of transformations to the data files they are working with.
30 ##################################################################### */
32 #ifndef PKGLIB_ACQUIRE_H
33 #define PKGLIB_ACQUIRE_H
39 #pragma interface "apt-pkg/acquire.h"
57 // List of items to fetch
60 // List of active queues and fetched method configuration parameters
63 MethodConfig
*Configs
;
64 unsigned long ToFetch
;
66 // Configurable parameters for the schedular
67 enum {QueueHost
,QueueAccess
} QueueMode
;
71 void Remove(Item
*Item
);
72 void Add(Worker
*Work
);
73 void Remove(Worker
*Work
);
75 void Enqueue(Item
*Item
,string URI
,string Description
);
76 void Dequeue(Item
*Item
);
77 string
QueueName(string URI
);
79 // FDSET managers for derived classes
80 void SetFds(int &Fd
,fd_set
*RSet
,fd_set
*WSet
);
81 void RunFds(fd_set
*RSet
,fd_set
*WSet
);
85 MethodConfig
*GetConfig(string Access
);
92 // List of possible items queued for download.
93 class pkgAcquire::Queue
108 pkgAcquire::Worker
*Worker
;
114 // Items queued into this queue
116 pkgAcquire::Worker
*Workers
;
121 // Put an item into this queue
122 void Enqueue(Item
*Owner
,string URI
,string Description
);
123 void Dequeue(Item
*Owner
);
125 // Find a Queued item
126 QItem
*FindItem(string URI
,pkgAcquire::Worker
*Owner
);
127 bool ItemDone(QItem
*Itm
);
132 Queue(string Name
,pkgAcquire
*Owner
);
136 // Configuration information from each method
137 struct pkgAcquire::MethodConfig