Package apt_p2p :: Module HTTPServer :: Class TopLevel
[hide private]
[frames] | no frames]

Class TopLevel

source code


The HTTP server for all requests, both from peers and apt.

Instance Methods [hide private]
 
__init__(self, directory, db, manager)
Initialize the instance.
source code
 
getHTTPFactory(self)
Initialize and get the factory for this HTTP server.
source code
 
render(self, ctx)
Render a web page with descriptive statistics.
source code
 
locateChild(self, request, segments)
Process the incoming request.
source code

Inherited from twisted.web2.resource.Resource: child_, http_GET, putChild

Inherited from twisted.web2.resource.RenderMixin: __providedBy__, allowedMethods, checkPreconditions, http_HEAD, http_OPTIONS, http_TRACE, renderHTTP

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables [hide private]
  addSlash = True

Inherited from twisted.web2.resource.Resource: __implemented__, __provides__

Instance Variables [hide private]
db.DB db
the database to use for looking up files and hashes
twisted.python.filepath.FilePath directory
the directory to check for cached files
twisted.web2.channel.HTTPFactory or policies.ThrottlingFactory factory
the factory to use to serve HTTP requests
apt_p2p.AptP2P manager
the main program object to send requests to
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, directory, db, manager)
(Constructor)

source code 

Initialize the instance.

Parameters:
  • directory (twisted.python.filepath.FilePath) - the directory to check for cached files
  • db (db.DB) - the database to use for looking up files and hashes
  • manager (apt_p2p.AptP2P) - the main program object to send requests to
Overrides: object.__init__

render(self, ctx)

source code 

Render a web page with descriptive statistics.

Parameters:
  • request - the request to process.
Returns:
an object adaptable to iweb.IResponse.
Overrides: twisted.web2.resource.RenderMixin.render

locateChild(self, request, segments)

source code 

Process the incoming request.

Parameters:
  • request - the request to process.
  • segments - a sequence of URL path segments.
Returns:
a tuple of (child, segments) containing the child of this resource which matches one or more of the given segments in sequence, and a list of remaining segments.
Overrides: twisted.web2.resource.Resource.locateChild