apt  0.9.14
acquire-worker.h
Go to the documentation of this file.
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: acquire-worker.h,v 1.12 2001/02/20 07:03:17 jgg Exp $
4 /* ######################################################################
5 
6  Acquire Worker - Worker process manager
7 
8  Each worker class is associated with exaclty one subprocess.
9 
10  ##################################################################### */
11  /*}}}*/
12 
19 #ifndef PKGLIB_ACQUIRE_WORKER_H
20 #define PKGLIB_ACQUIRE_WORKER_H
21 
22 #include <apt-pkg/acquire.h>
23 #include <apt-pkg/weakptr.h>
24 
25 
46 {
48  void *d;
49 
50  friend class pkgAcquire;
51 
52  protected:
53  friend class Queue;
54 
60 
63 
66 
71 
77 
82  std::string Access;
83 
85  pid_t Process;
86 
92  int InFd;
93 
99  int OutFd;
100 
106  bool InReady;
107 
113  bool OutReady;
114 
116  bool Debug;
117 
121  std::vector<std::string> MessageQueue;
122 
127  std::string OutQueue;
128 
135  void Construct();
136 
147  bool ReadMessages();
148 
158  bool RunMessages();
159 
166  bool InFdReady();
167 
175  bool OutFdReady();
176 
186  bool Capabilities(std::string Message);
187 
204  bool SendConfiguration();
205 
217  bool MediaChange(std::string Message);
218 
228  bool MethodFailure();
229 
235  void ItemDone();
236 
237  public:
238 
241 
245  std::string Status;
246 
250  unsigned long long CurrentSize;
251 
255  unsigned long long TotalSize;
256 
260  unsigned long long ResumePoint;
261 
272 
280  bool Start();
281 
285  void Pulse();
286 
288  inline const MethodConfig *GetConf() const {return Config;};
289 
302 
314 
320  virtual ~Worker();
321 };
322 
325 #endif
pid_t Process
The PID of the subprocess.
Definition: acquire-worker.h:85
unsigned long long ResumePoint
How much of the file was already downloaded prior to starting this worker.
Definition: acquire-worker.h:260
bool MethodFailure()
Invoked when the worked process dies unexpectedly.
Definition: acquire-worker.cc:568
int OutFd
A file descriptor connected to the standard input of the subprocess.
Definition: acquire-worker.h:99
std::string Access
The access method to be used by this worker.
Definition: acquire-worker.h:82
std::vector< std::string > MessageQueue
The raw text values of messages received from the worker, in sequence.
Definition: acquire-worker.h:121
bool MediaChange(std::string Message)
Handle a 403 Media Change message.
Definition: acquire-worker.cc:439
virtual ~Worker()
Clean up this worker.
Definition: acquire-worker.cc:89
bool OutFdReady()
Send any pending commands to the subprocess.
Definition: acquire-worker.cc:534
MethodConfig * Config
The configuration of this method. On startup, the target of this pointer is filled in with basic data...
Definition: acquire-worker.h:76
int InFd
A file descriptor connected to the standard output of the subprocess.
Definition: acquire-worker.h:92
pkgAcquire::Queue::QItem * CurrentItem
The queue entry that is currently being downloaded.
Definition: acquire-worker.h:240
Queue * OwnerQ
The Queue with which this worker is associated.
Definition: acquire-worker.h:65
Worker(Queue *OwnerQ, MethodConfig *Config, pkgAcquireStatus *Log)
Create a new Worker to download files.
Definition: acquire-worker.cc:43
The core download scheduler. {{{.
Definition: acquire.h:93
bool InReady
Set to true if the worker is in a state in which it might generate data or command responses...
Definition: acquire-worker.h:106
void Pulse()
Update the worker statistics (CurrentSize, TotalSize, etc).
Definition: acquire-worker.cc:590
bool Start()
Start up the worker and fill in Config.
Definition: acquire-worker.cc:107
void ItemDone()
Invoked when a fetch job is completed, either successfully or unsuccessfully.
Definition: acquire-worker.cc:608
bool OutReady
Set to true if the worker is in a state in which it is legal to send commands to it.
Definition: acquire-worker.h:113
A monitor object for downloads controlled by the pkgAcquire class. {{{.
Definition: acquire.h:657
bool ReadMessages()
Retrieve any available messages from the subprocess.
Definition: acquire-worker.cc:173
unsigned long long TotalSize
The total number of bytes to be downloaded. Zero if the total size of the final is unknown...
Definition: acquire-worker.h:255
Worker * NextQueue
The next link on the Queue list.
Definition: acquire-worker.h:59
bool RunMessages()
Parse and dispatch pending messages.
Definition: acquire-worker.cc:184
unsigned long long CurrentSize
How many bytes of the file have been downloaded. Zero if the current progress of the file cannot be d...
Definition: acquire-worker.h:250
bool SendConfiguration()
Send a 601 Configuration message (containing the APT configuration) to the subprocess.
Definition: acquire-worker.cc:485
A single item placed in this queue.
Definition: acquire.h:404
Represents the process by which a pkgAcquire object should {{{ retrieve a file or a collection of fil...
Definition: acquire-item.h:58
Worker * NextAcquire
The next link on the Acquire list.
Definition: acquire-worker.h:62
std::string OutQueue
Buffers pending writes to the subprocess.
Definition: acquire-worker.h:127
bool InFdReady()
Read and dispatch any pending messages from the subprocess.
Definition: acquire-worker.cc:556
void Construct()
Common code for the constructor.
Definition: acquire-worker.cc:74
bool Capabilities(std::string Message)
Handle a 100 Capabilities response from the subprocess.
Definition: acquire-worker.cc:407
pkgAcquireStatus * Log
The download progress indicator to which progress messages should be sent.
Definition: acquire-worker.h:70
Information about the properties of a single acquire method. {{{.
Definition: acquire.h:595
A single download queue in a pkgAcquire object. {{{.
Definition: acquire.h:389
bool Debug
Definition: acquire-worker.h:116
std::string Status
The most recent status string received from the subprocess.
Definition: acquire-worker.h:245
bool QueueItem(pkgAcquire::Queue::QItem *Item)
Tell the subprocess to download the given item.
Definition: acquire-worker.cc:511
const MethodConfig * GetConf() const
Definition: acquire-worker.h:288
Definition: weakptr.h:34
A fetch subprocess.
Definition: acquire-worker.h:45