Page Speed Optimization Libraries  1.8.31.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Attributes
net_instaweb::SimulatedDelayFetcher Class Reference

#include "simulated_delay_fetcher.h"

Inheritance diagram for net_instaweb::SimulatedDelayFetcher:
net_instaweb::UrlAsyncFetcher

List of all members.

Public Member Functions

 SimulatedDelayFetcher (ThreadSystem *thread_system, Timer *timer, Scheduler *scheduler, MessageHandler *handler, FileSystem *file_system, StringPiece delay_map_path, StringPiece request_log_path, int request_log_flush_frequency)
virtual void Fetch (const GoogleString &url, MessageHandler *message_handler, AsyncFetch *fetch)

Static Public Attributes

static const char kPayload []
 The payload that this will deliver.

Detailed Description

SimulatedDelayFetcher lets one configure various per-host delays, and will make hardcoded replies according to those replies. This exists to help run simulations of server behavior with sites of widely various speeds.


Constructor & Destructor Documentation

net_instaweb::SimulatedDelayFetcher::SimulatedDelayFetcher ( ThreadSystem *  thread_system,
Timer *  timer,
Scheduler *  scheduler,
MessageHandler *  handler,
FileSystem *  file_system,
StringPiece  delay_map_path,
StringPiece  request_log_path,
int  request_log_flush_frequency 
)

delay_map_path is the path to the file describing the delays for each host The format is: foo.com=4;bar.com=42;baz.com=43; (line breaks are permitted) The delays are in milliseconds.

request_log_path will be used to log when each request was received. (Not when it was served).


Member Function Documentation

virtual void net_instaweb::SimulatedDelayFetcher::Fetch ( const GoogleString &  url,
MessageHandler *  message_handler,
AsyncFetch fetch 
) [virtual]

Asynchronously fetch a URL, set the response headers and stream the contents to fetch and call fetch->Done() when the fetch finishes.

There is an unchecked contract that response_headers are set before the response_writer or callback are used. Caution, several implementations do not satisfy this contract (but should).

Todo:

TODO(sligocki): GoogleString -> GoogleUrl or at least StringPiece.

TODO(sligocki): Include the URL in the fetch, like the request headers.

Implements net_instaweb::UrlAsyncFetcher.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines