apt @VERSION@

acquire-worker.h

Go to the documentation of this file.
00001 // -*- mode: cpp; mode: fold -*-
00002 // Description                                                          /*{{{*/
00003 // $Id: acquire-worker.h,v 1.12 2001/02/20 07:03:17 jgg Exp $
00004 /* ######################################################################
00005 
00006    Acquire Worker - Worker process manager
00007    
00008    Each worker class is associated with exaclty one subprocess.
00009    
00010    ##################################################################### */
00011                                                                         /*}}}*/
00012 
00019 #ifndef PKGLIB_ACQUIRE_WORKER_H
00020 #define PKGLIB_ACQUIRE_WORKER_H
00021 
00022 #include <apt-pkg/acquire.h>
00023 #include <apt-pkg/weakptr.h>
00024 
00025 
00045 class pkgAcquire::Worker : public WeakPointable
00046 {
00047    friend class pkgAcquire;
00048    
00049    protected:
00050    friend class Queue;
00051 
00056    Worker *NextQueue;
00057 
00059    Worker *NextAcquire;
00060    
00062    Queue *OwnerQ;
00063 
00067    pkgAcquireStatus *Log;
00068 
00073    MethodConfig *Config;
00074 
00079    string Access;
00080 
00082    pid_t Process;
00083 
00089    int InFd;
00090 
00096    int OutFd;
00097 
00103    bool InReady;
00104 
00110    bool OutReady;
00111    
00113    bool Debug;
00114 
00118    vector<string> MessageQueue;
00119 
00124    string OutQueue;
00125    
00132    void Construct();
00133    
00144    bool ReadMessages();
00145 
00155    bool RunMessages();
00156 
00163    bool InFdReady();
00164 
00172    bool OutFdReady();
00173    
00183    bool Capabilities(string Message);
00184 
00201    bool SendConfiguration();
00202 
00214    bool MediaChange(string Message);
00215    
00225    bool MethodFailure();
00226 
00232    void ItemDone();
00233    
00234    public:
00235    
00237    pkgAcquire::Queue::QItem *CurrentItem;
00238 
00242    string Status;
00243 
00247    unsigned long CurrentSize;
00248 
00252    unsigned long TotalSize;
00253 
00257    unsigned long ResumePoint;
00258    
00268    bool QueueItem(pkgAcquire::Queue::QItem *Item);
00269 
00277    bool Start();
00278 
00282    void Pulse();
00283 
00285    inline const MethodConfig *GetConf() const {return Config;};
00286 
00298    Worker(Queue *OwnerQ,MethodConfig *Config,pkgAcquireStatus *Log);
00299 
00310    Worker(MethodConfig *Config);
00311 
00317    ~Worker();
00318 };
00319 
00322 #endif