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 {
00048    void *d;
00049   
00050    friend class pkgAcquire;
00051    
00052    protected:
00053    friend class Queue;
00054 
00059    Worker *NextQueue;
00060 
00062    Worker *NextAcquire;
00063    
00065    Queue *OwnerQ;
00066 
00070    pkgAcquireStatus *Log;
00071 
00076    MethodConfig *Config;
00077 
00082    std::string Access;
00083 
00085    pid_t Process;
00086 
00092    int InFd;
00093 
00099    int OutFd;
00100 
00106    bool InReady;
00107 
00113    bool OutReady;
00114    
00116    bool Debug;
00117 
00121    std::vector<std::string> MessageQueue;
00122 
00127    std::string OutQueue;
00128    
00135    void Construct();
00136    
00147    bool ReadMessages();
00148 
00158    bool RunMessages();
00159 
00166    bool InFdReady();
00167 
00175    bool OutFdReady();
00176    
00186    bool Capabilities(std::string Message);
00187 
00204    bool SendConfiguration();
00205 
00217    bool MediaChange(std::string Message);
00218    
00228    bool MethodFailure();
00229 
00235    void ItemDone();
00236    
00237    public:
00238    
00240    pkgAcquire::Queue::QItem *CurrentItem;
00241 
00245    std::string Status;
00246 
00250    unsigned long long CurrentSize;
00251 
00255    unsigned long long TotalSize;
00256 
00260    unsigned long long ResumePoint;
00261    
00271    bool QueueItem(pkgAcquire::Queue::QItem *Item);
00272 
00280    bool Start();
00281 
00285    void Pulse();
00286 
00288    inline const MethodConfig *GetConf() const {return Config;};
00289 
00301    Worker(Queue *OwnerQ,MethodConfig *Config,pkgAcquireStatus *Log);
00302 
00313    Worker(MethodConfig *Config);
00314 
00320    virtual ~Worker();
00321 };
00322 
00325 #endif