41.3 Representing web pages

We represent web pages as the abstract class Page. It is defined as follows:

class Page {
        Page(int size) : size_(size) {}
        int size() const { return size_; }
        int& id() { return id_; }
        virtual WebPageType type() const = 0;

        int size_;
        int id_;

It represents the basic properties of a web page: size and URL. Upon it we derive two classes of web pages: ServerPage and ClientPage. The former contains a list of page modification times, and is supposed to by used by servers. It was originally designed to work with a special web server trace; currently it is not widely used in ns. The latter, ClientPage, is the default web page for all page pools below.

A ClientPage has the following major properties (we omit some variables used by web cache with invalidation, which has too many details to be covered here):

The status (32-bit) of a ClientPage is separated into two 16-bit parts. The first part (with mask 0x00FF) is used to store page status, the second part (with mask 0xFF00) is used to store expected page actions to be performed by cache. Available page status are (again, we omit those closely related to web cache invalidation):

rX HTTP_VALID_PAGE & Page is valid.
HTTP_UNCACHEABLE & Page is uncacheable. This option can be used to simulate CGI pages or dynamic server pages.

CilentPage has the following major C++ methods:

Tom Henderson 2011-11-05