]> git.saurik.com Git - apt.git/blame - apt-pkg/acquire-worker.h
* removed the pragma mess
[apt.git] / apt-pkg / acquire-worker.h
CommitLineData
0118833a
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
b2e465d6 3// $Id: acquire-worker.h,v 1.12 2001/02/20 07:03:17 jgg Exp $
0118833a
AL
4/* ######################################################################
5
6 Acquire Worker - Worker process manager
7
3b5421b4
AL
8 Each worker class is associated with exaclty one subprocess.
9
0118833a
AL
10 ##################################################################### */
11 /*}}}*/
12#ifndef PKGLIB_ACQUIRE_WORKER_H
13#define PKGLIB_ACQUIRE_WORKER_H
14
15#include <apt-pkg/acquire.h>
16
0118833a
AL
17
18// Interfacing to the method process
19class pkgAcquire::Worker
20{
b2e465d6 21 friend class pkgAcquire;
0a8a80e5 22
0118833a 23 protected:
b2e465d6 24 friend class Queue;
3b5421b4 25
0a8a80e5
AL
26 /* Linked list starting at a Queue and a linked list starting
27 at Acquire */
28 Worker *NextQueue;
29 Worker *NextAcquire;
0118833a 30
3b5421b4 31 // The access association
0118833a 32 Queue *OwnerQ;
8267fe24 33 pkgAcquireStatus *Log;
3b5421b4
AL
34 MethodConfig *Config;
35 string Access;
c46824ce 36
3b5421b4
AL
37 // This is the subprocess IPC setup
38 pid_t Process;
39 int InFd;
40 int OutFd;
0a8a80e5
AL
41 bool InReady;
42 bool OutReady;
0118833a 43
3b5421b4
AL
44 // Various internal things
45 bool Debug;
46 vector<string> MessageQueue;
0a8a80e5
AL
47 string OutQueue;
48
3b5421b4
AL
49 // Private constructor helper
50 void Construct();
51
52 // Message handling things
53 bool ReadMessages();
54 bool RunMessages();
0a8a80e5
AL
55 bool InFdReady();
56 bool OutFdReady();
3b5421b4
AL
57
58 // The message handlers
59 bool Capabilities(string Message);
0a8a80e5 60 bool SendConfiguration();
542ec555
AL
61 bool MediaChange(string Message);
62
0a8a80e5 63 bool MethodFailure();
8267fe24 64 void ItemDone();
0118833a
AL
65
66 public:
67
c88edf1d 68 // The curent method state
0a8a80e5 69 pkgAcquire::Queue::QItem *CurrentItem;
0a8a80e5 70 string Status;
c88edf1d
AL
71 unsigned long CurrentSize;
72 unsigned long TotalSize;
8b75eb1c
AL
73 unsigned long ResumePoint;
74
3b5421b4 75 // Load the method and do the startup
0a8a80e5 76 bool QueueItem(pkgAcquire::Queue::QItem *Item);
8267fe24
AL
77 bool Start();
78 void Pulse();
8e5fc8f5 79 inline const MethodConfig *GetConf() const {return Config;};
0118833a 80
8267fe24 81 Worker(Queue *OwnerQ,MethodConfig *Config,pkgAcquireStatus *Log);
0118833a
AL
82 Worker(MethodConfig *Config);
83 ~Worker();
84};
85
86#endif