]> git.saurik.com Git - apt.git/blame - methods/mirror.h
eipp: add Allow-Temporary-Remove-of-Essentials
[apt.git] / methods / mirror.h
CommitLineData
5f6b130d 1// -*- mode: cpp; mode: fold -*-
8b79c94a 2// Description /*{{{*/
5f6b130d
MV
3/* ######################################################################
4
1e3f4083 5 MIRROR Acquire Method - This is the MIRROR acquire method for APT.
5f6b130d
MV
6
7 ##################################################################### */
8 /*}}}*/
9
10#ifndef APT_MIRROR_H
11#define APT_MIRROR_H
12
5f6b130d 13#include <iostream>
472ff00e
DK
14#include <string>
15#include <vector>
5f6b130d
MV
16
17using std::cout;
18using std::cerr;
19using std::endl;
20
21#include "http.h"
22
14e097c1 23class MirrorMethod : public HttpMethod
5f6b130d
MV
24{
25 FetchResult Res;
86c17f0a 26 // we simply transform between BaseUri and Mirror
472ff00e
DK
27 std::string BaseUri; // the original mirror://... url
28 std::string Mirror; // the selected mirror uri (http://...)
29 std::vector<std::string> AllMirrors; // all available mirrors
30 std::string MirrorFile; // the file that contains the list of mirrors
38eedeb7 31 bool DownloadedMirrorFile; // already downloaded this session
472ff00e 32 std::string Dist; // the target distrubtion (e.g. sid, oneiric)
5f6b130d 33
14e097c1
MV
34 bool Debug;
35
5f6b130d 36 protected:
472ff00e
DK
37 bool DownloadMirrorFile(std::string uri);
38 bool RandomizeMirrorFile(std::string file);
39 std::string GetMirrorFileName(std::string uri);
96db74ce 40 bool InitMirrors();
03915427
MV
41 bool TryNextMirror();
42 void CurrentQueueUriToMirror();
472ff00e 43 bool Clean(std::string dir);
86c17f0a
MV
44
45 // we need to overwrite those to transform the url back
3b302846
DK
46 virtual void Fail(std::string Why, bool Transient = false) APT_OVERRIDE;
47 virtual void URIStart(FetchResult &Res) APT_OVERRIDE;
48 virtual void URIDone(FetchResult &Res,FetchResult *Alt = 0) APT_OVERRIDE;
49 virtual bool Configuration(std::string Message) APT_OVERRIDE;
14e097c1 50
5f6b130d
MV
51 public:
52 MirrorMethod();
3b302846 53 virtual bool Fetch(FetchItem *Itm) APT_OVERRIDE;
5f6b130d
MV
54};
55
56
57#endif