apt-proxy design
================

This file documents the design of apt-proxy.  Read this if you
want to hack on apt-proxy


Overview
--------

On startup, class apConfig loads the configuration, and creates an
apBackendConfig for each backend specified in the config file.

A single Factory instance is created, which contains references to
the configuraiton and the packages / access times databases.

The factory creates a Backend for each [backend-name] section in the
config file, eg debian, debian-security.  The Backend holds a list
of BackendServers.  Each BackendServer points to a different server
on the internet, e.g. http://ftp.debian.org, ftp://uk.debian.org.

Each time a new incomming connection is made, factory.buildProtocol 
creates a Channel.  There is one Channel per client connection.

Each time a client sends an HTTP request, a new Request is created.

If a file is not already available, a FetcherXXX is created to retrieve
the file from the backend.  Note: the Fetcher class structure will be
reworked in an upcoming version.

Generating documentation for individual classes
-----------------------------------------------
Each class is documented in the source code.  To extract documentation use
this command:

  

Databases
---------

1. Databases managed by Factory

each file path in the factory databases is the URL with the cache_dir
prefix removed, for example: debian/pool/main/a/apt-proxy/apt-proxy_1.9.0_all.deb

Factory.update_times
  key: file path
  value: time when last updated (seconds since the epoch)

Factory.access_times
  key: file path
  value: time when last request by a client (seconds since the epoch)

Factory.packages
  key: package name (e.g. apt)
  value: list of file paths for each package in the cache that has that package name

2. Databases managed by Backends

AptPackages.packages (pointed to by Backend.packages)
  key: Packages file path, for example: debian/dists/main/binary-i386/Packages
  value: mtime - file when last downloaded (seconds since the epoch)

