]>
Commit | Line | Data |
---|---|---|
0118833a AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
3b5421b4 | 3 | // $Id: acquire.h,v 1.2 1998/10/20 02:39:16 jgg Exp $ |
0118833a AL |
4 | /* ###################################################################### |
5 | ||
6 | Acquire - File Acquiration | |
7 | ||
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. | |
11 | ||
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. | |
21 | ||
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. | |
25 | ||
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. | |
29 | ||
30 | ##################################################################### */ | |
31 | /*}}}*/ | |
32 | #ifndef PKGLIB_ACQUIRE_H | |
33 | #define PKGLIB_ACQUIRE_H | |
34 | ||
35 | #include <vector> | |
36 | #include <string> | |
37 | ||
38 | #ifdef __GNUG__ | |
39 | #pragma interface "apt-pkg/acquire.h" | |
40 | #endif | |
41 | ||
42 | class pkgAcquire | |
43 | { | |
44 | public: | |
45 | ||
46 | class Item; | |
47 | class Queue; | |
48 | class Worker; | |
49 | struct MethodConfig; | |
50 | friend Item; | |
51 | ||
52 | protected: | |
53 | ||
54 | vector<Item *> Items; | |
55 | Queue *Queues; | |
56 | MethodConfig *Configs; | |
57 | ||
58 | void Add(Item *Item); | |
59 | void Remove(Item *Item); | |
60 | void Enqueue(Item *Item,string URI); | |
61 | ||
62 | public: | |
3b5421b4 AL |
63 | |
64 | const MethodConfig *GetConfig(string Access); | |
65 | string QueueName(string URI); | |
0118833a AL |
66 | |
67 | pkgAcquire(); | |
68 | ~pkgAcquire(); | |
69 | }; | |
70 | ||
71 | // List of possible items queued for download. | |
72 | class pkgAcquire::Queue | |
73 | { | |
74 | friend pkgAcquire; | |
75 | Queue *Next; | |
76 | ||
77 | protected: | |
78 | ||
0118833a | 79 | string URIMatch; |
3b5421b4 | 80 | |
0118833a AL |
81 | vector<Item *> Items; |
82 | ||
83 | public: | |
84 | }; | |
85 | ||
86 | // Configuration information from each method | |
87 | struct pkgAcquire::MethodConfig | |
88 | { | |
3b5421b4 AL |
89 | MethodConfig *Next; |
90 | ||
0118833a AL |
91 | string Access; |
92 | ||
93 | string Version; | |
94 | bool SingleInstance; | |
95 | bool PreScan; | |
96 | ||
97 | MethodConfig(); | |
0118833a AL |
98 | }; |
99 | ||
100 | #endif |