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