X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/0118833a3b3e65ad7296863aa7d49574eb615f83..9a9665f96e006602950e0e32ce80cb5ee14f5e5f:/apt-pkg/acquire-worker.h?ds=sidebyside diff --git a/apt-pkg/acquire-worker.h b/apt-pkg/acquire-worker.h index f01c935ae..6e1952202 100644 --- a/apt-pkg/acquire-worker.h +++ b/apt-pkg/acquire-worker.h @@ -1,10 +1,12 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire-worker.h,v 1.1 1998/10/15 06:59:59 jgg Exp $ +// $Id: acquire-worker.h,v 1.12 2001/02/20 07:03:17 jgg Exp $ /* ###################################################################### Acquire Worker - Worker process manager + Each worker class is associated with exaclty one subprocess. + ##################################################################### */ /*}}}*/ #ifndef PKGLIB_ACQUIRE_WORKER_H @@ -19,19 +21,67 @@ // Interfacing to the method process class pkgAcquire::Worker { + friend class pkgAcquire; + protected: + friend class Queue; + + /* Linked list starting at a Queue and a linked list starting + at Acquire */ + Worker *NextQueue; + Worker *NextAcquire; + // The access association Queue *OwnerQ; - MethodConfig *Config; - Worker *Next; + pkgAcquireStatus *Log; + MethodConfig *Config; + string Access; + + // This is the subprocess IPC setup + pid_t Process; + int InFd; + int OutFd; + bool InReady; + bool OutReady; + + // Various internal things + bool Debug; + vector MessageQueue; + string OutQueue; - friend Queue; + // Private constructor helper + void Construct(); + + // Message handling things + bool ReadMessages(); + bool RunMessages(); + bool InFdReady(); + bool OutFdReady(); + + // The message handlers + bool Capabilities(string Message); + bool SendConfiguration(); + bool MediaChange(string Message); + + bool MethodFailure(); + void ItemDone(); public: - bool Create(); + // The curent method state + pkgAcquire::Queue::QItem *CurrentItem; + string Status; + unsigned long CurrentSize; + unsigned long TotalSize; + unsigned long ResumePoint; + + // Load the method and do the startup + bool QueueItem(pkgAcquire::Queue::QItem *Item); + bool Start(); + void Pulse(); + inline const MethodConfig *GetConf() const {return Config;}; - Worker(Queue *OwnerQ); + Worker(Queue *OwnerQ,MethodConfig *Config,pkgAcquireStatus *Log); Worker(MethodConfig *Config); ~Worker(); };