X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/0118833a3b3e65ad7296863aa7d49574eb615f83..93bf083d699c60f1ac40297bfa6783fb0cb800d8:/apt-pkg/acquire.h diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index b728d2133..20ce2873f 100644 --- a/apt-pkg/acquire.h +++ b/apt-pkg/acquire.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire.h,v 1.1 1998/10/15 06:59:59 jgg Exp $ +// $Id: acquire.h,v 1.6 1998/10/30 07:53:38 jgg Exp $ /* ###################################################################### Acquire - File Acquiration @@ -39,6 +39,8 @@ #pragma interface "apt-pkg/acquire.h" #endif +#include + class pkgAcquire { public: @@ -48,18 +50,44 @@ class pkgAcquire class Worker; struct MethodConfig; friend Item; + friend Queue; protected: + // List of items to fetch vector Items; + + // List of active queues and fetched method configuration parameters Queue *Queues; + Worker *Workers; MethodConfig *Configs; + unsigned long ToFetch; + + // Configurable parameters for the schedular + enum {QueueHost,QueueAccess} QueueMode; + bool Debug; + bool Running; void Add(Item *Item); void Remove(Item *Item); - void Enqueue(Item *Item,string URI); + void Add(Worker *Work); + void Remove(Worker *Work); + + void Enqueue(Item *Item,string URI,string Description); + void Dequeue(Item *Item); + string QueueName(string URI); + + // FDSET managers for derived classes + void SetFds(int &Fd,fd_set *RSet,fd_set *WSet); + void RunFds(fd_set *RSet,fd_set *WSet); + + // A queue calls this when it dequeues an item + void Bump(); public: + + MethodConfig *GetConfig(string Access); + bool Run(); pkgAcquire(); ~pkgAcquire(); @@ -72,26 +100,58 @@ class pkgAcquire::Queue Queue *Next; protected: + + // Queued item + struct QItem + { + QItem *Next; + + string URI; + string Description; + Item *Owner; + pkgAcquire::Worker *Worker; + }; + + // Name of the queue + string Name; + + // Items queued into this queue + QItem *Items; + pkgAcquire::Worker *Workers; + pkgAcquire *Owner; - string Access; - string URIMatch; + public: - vector Items; + // Put an item into this queue + void Enqueue(Item *Owner,string URI,string Description); + void Dequeue(Item *Owner); + + // Find a Queued item + QItem *FindItem(string URI,pkgAcquire::Worker *Owner); + bool ItemDone(QItem *Itm); - public: + bool Startup(); + bool Shutdown(); + bool Cycle(); + + Queue(string Name,pkgAcquire *Owner); + ~Queue(); }; // Configuration information from each method struct pkgAcquire::MethodConfig { + MethodConfig *Next; + string Access; string Version; bool SingleInstance; bool PreScan; + bool Pipeline; + bool SendConfig; MethodConfig(); - ~MethodConfig(); }; #endif