acquire.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: acquire.h,v 1.1 1998/10/15 06:59:59 jgg Exp $
  4. /* ######################################################################
  5. Acquire - File Acquiration
  6. This module contians the Acquire system. It is responsible for bringing
  7. files into the local pathname space. It deals with URIs for files and
  8. URI handlers responsible for downloading or finding the URIs.
  9. Each file to download is represented by an Acquire::Item class subclassed
  10. into a specialization. The Item class can add itself to several URI
  11. acquire queues each prioritized by the download scheduler. When the
  12. system is run the proper URI handlers are spawned and the the acquire
  13. queues are fed into the handlers by the schedular until the queues are
  14. empty. This allows for an Item to be downloaded from an alternate source
  15. if the first try turns out to fail. It also alows concurrent downloading
  16. of multiple items from multiple sources as well as dynamic balancing
  17. of load between the sources.
  18. Schedualing of downloads is done on a first ask first get basis. This
  19. preserves the order of the download as much as possible. And means the
  20. fastest source will tend to process the largest number of files.
  21. Internal methods and queues for performing gzip decompression,
  22. md5sum hashing and file copying are provided to allow items to apply
  23. a number of transformations to the data files they are working with.
  24. ##################################################################### */
  25. /*}}}*/
  26. #ifndef PKGLIB_ACQUIRE_H
  27. #define PKGLIB_ACQUIRE_H
  28. #include <vector>
  29. #include <string>
  30. #ifdef __GNUG__
  31. #pragma interface "apt-pkg/acquire.h"
  32. #endif
  33. class pkgAcquire
  34. {
  35. public:
  36. class Item;
  37. class Queue;
  38. class Worker;
  39. struct MethodConfig;
  40. friend Item;
  41. protected:
  42. vector<Item *> Items;
  43. Queue *Queues;
  44. MethodConfig *Configs;
  45. void Add(Item *Item);
  46. void Remove(Item *Item);
  47. void Enqueue(Item *Item,string URI);
  48. public:
  49. pkgAcquire();
  50. ~pkgAcquire();
  51. };
  52. // List of possible items queued for download.
  53. class pkgAcquire::Queue
  54. {
  55. friend pkgAcquire;
  56. Queue *Next;
  57. protected:
  58. string Access;
  59. string URIMatch;
  60. vector<Item *> Items;
  61. public:
  62. };
  63. // Configuration information from each method
  64. struct pkgAcquire::MethodConfig
  65. {
  66. string Access;
  67. string Version;
  68. bool SingleInstance;
  69. bool PreScan;
  70. MethodConfig();
  71. ~MethodConfig();
  72. };
  73. #endif