]> git.saurik.com Git - apt.git/blob - apt-pkg/acquire-worker.h
Sync
[apt.git] / apt-pkg / acquire-worker.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: acquire-worker.h,v 1.6 1998/10/30 07:53:36 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 #ifndef PKGLIB_ACQUIRE_WORKER_H
13 #define PKGLIB_ACQUIRE_WORKER_H
14
15 #include <apt-pkg/acquire.h>
16
17 #ifdef __GNUG__
18 #pragma interface "apt-pkg/acquire-worker.h"
19 #endif
20
21 // Interfacing to the method process
22 class pkgAcquire::Worker
23 {
24 friend pkgAcquire;
25
26 protected:
27 friend Queue;
28
29 /* Linked list starting at a Queue and a linked list starting
30 at Acquire */
31 Worker *NextQueue;
32 Worker *NextAcquire;
33
34 // The access association
35 Queue *OwnerQ;
36 MethodConfig *Config;
37 string Access;
38
39 // This is the subprocess IPC setup
40 pid_t Process;
41 int InFd;
42 int OutFd;
43 bool InReady;
44 bool OutReady;
45
46 // Various internal things
47 bool Debug;
48 vector<string> MessageQueue;
49 string OutQueue;
50
51 // Private constructor helper
52 void Construct();
53
54 // Message handling things
55 bool ReadMessages();
56 bool RunMessages();
57 bool InFdReady();
58 bool OutFdReady();
59
60 // The message handlers
61 bool Capabilities(string Message);
62 bool SendConfiguration();
63
64 bool MethodFailure();
65
66 public:
67
68 // The curent method state
69 pkgAcquire::Queue::QItem *CurrentItem;
70 string Status;
71 unsigned long CurrentSize;
72 unsigned long TotalSize;
73
74 // Load the method and do the startup
75 bool QueueItem(pkgAcquire::Queue::QItem *Item);
76 bool Start();
77
78 Worker(Queue *OwnerQ,MethodConfig *Config);
79 Worker(MethodConfig *Config);
80 ~Worker();
81 };
82
83 #endif