]> git.saurik.com Git - apt.git/blame - apt-pkg/acquire-item.h
Fail over
[apt.git] / apt-pkg / acquire-item.h
CommitLineData
0118833a
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
db890fdb 3// $Id: acquire-item.h,v 1.12 1998/12/11 06:32:34 jgg Exp $
0118833a
AL
4/* ######################################################################
5
6 Acquire Item - Item to acquire
7
8 When an item is instantiated it will add it self to the local list in
9 the Owner Acquire class. Derived classes will then call QueueURI to
10 register all the URI's they wish to fetch for at the initial moment.
11
12 Two item classes are provided to provide functionality for downloading
13 of Index files and downloading of Packages.
14
b185acc2
AL
15 A Archive class is provided for downloading .deb files. It does Md5
16 checking and source location.
17
0118833a
AL
18 ##################################################################### */
19 /*}}}*/
20#ifndef PKGLIB_ACQUIRE_ITEM_H
21#define PKGLIB_ACQUIRE_ITEM_H
22
23#include <apt-pkg/acquire.h>
24#include <apt-pkg/sourcelist.h>
03e39e59 25#include <apt-pkg/pkgrecords.h>
0118833a
AL
26
27#ifdef __GNUG__
28#pragma interface "apt-pkg/acquire-item.h"
29#endif
30
31// Item to acquire
32class pkgAcquire::Item
33{
34 protected:
35
36 pkgAcquire *Owner;
8267fe24
AL
37 inline void QueueURI(ItemDesc &Item)
38 {Owner->Enqueue(Item);};
0118833a 39
8b89e57f
AL
40 void Rename(string From,string To);
41
0118833a
AL
42 public:
43
c88edf1d
AL
44 // State of the item
45 enum {StatIdle, StatFetching, StatDone, StatError} Status;
46 string ErrorText;
8267fe24 47 unsigned long FileSize;
b98f2859
AL
48 char *Mode;
49 unsigned long ID;
8267fe24 50 bool Complete;
a6568219 51 bool Local;
30e1eab5 52
0a8a80e5 53 // Number of queues we are inserted into
0118833a 54 unsigned int QueueCounter;
0118833a 55
0a8a80e5
AL
56 // File to write the fetch into
57 string DestFile;
0118833a 58
c88edf1d
AL
59 virtual void Failed(string Message);
60 virtual void Done(string Message,unsigned long Size,string Md5Hash);
8267fe24 61 virtual void Start(string Message,unsigned long Size);
30e1eab5
AL
62 virtual string Describe() = 0;
63
0a8a80e5
AL
64 virtual string Custom600Headers() {return string();};
65
0118833a
AL
66 Item(pkgAcquire *Owner);
67 virtual ~Item();
68};
69
70// Item class for index files
71class pkgAcqIndex : public pkgAcquire::Item
72{
73 protected:
74
75 const pkgSourceList::Item *Location;
8b89e57f 76 bool Decompression;
bfd22fc0 77 bool Erase;
8267fe24 78 pkgAcquire::ItemDesc Desc;
0118833a
AL
79
80 public:
81
8b89e57f 82 virtual void Done(string Message,unsigned long Size,string Md5Hash);
0a8a80e5 83 virtual string Custom600Headers();
30e1eab5 84 virtual string Describe();
0118833a
AL
85
86 pkgAcqIndex(pkgAcquire *Owner,const pkgSourceList::Item *Location);
87};
88
89// Item class for index files
90class pkgAcqIndexRel : public pkgAcquire::Item
91{
92 protected:
93
94 const pkgSourceList::Item *Location;
8267fe24 95 pkgAcquire::ItemDesc Desc;
0118833a
AL
96
97 public:
98
8b89e57f 99 virtual void Done(string Message,unsigned long Size,string Md5Hash);
0a8a80e5 100 virtual string Custom600Headers();
30e1eab5 101 virtual string Describe();
0a8a80e5 102
0118833a
AL
103 pkgAcqIndexRel(pkgAcquire *Owner,const pkgSourceList::Item *Location);
104};
105
03e39e59
AL
106// Item class for archive files
107class pkgAcqArchive : public pkgAcquire::Item
108{
109 protected:
110
111 pkgCache::VerIterator Version;
112 pkgAcquire::ItemDesc Desc;
113 pkgSourceList *Sources;
114 pkgRecords *Recs;
115 string MD5;
30e1eab5 116 string &StoreFilename;
b185acc2
AL
117 pkgCache::VerFileIterator Vf;
118
119 bool QueueNext();
03e39e59
AL
120
121 public:
122
db890fdb 123 virtual void Failed(string Message);
03e39e59 124 virtual void Done(string Message,unsigned long Size,string Md5Hash);
30e1eab5 125 virtual string Describe();
03e39e59
AL
126
127 pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
30e1eab5
AL
128 pkgRecords *Recs,pkgCache::VerIterator const &Version,
129 string &StoreFilename);
03e39e59
AL
130};
131
0118833a 132#endif