Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

ClientPage Class Reference

#include <pagepool.h>

Inheritance diagram for ClientPage:

Inheritance graph
[legend]
Collaboration diagram for ClientPage:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ClientPage (const char *n, int s, double mt, double et, double a)
virtual ~ClientPage ()
virtual WebPageType type () const
virtual void print_info (char *buf)
void name (char *buf)
double & mtime ()
double & etime ()
double & age ()
HttpAppserver ()
void validate (double mtime)
void invalidate (double mtime)
int is_valid () const
int is_header_valid () const
void set_valid_hdr ()
void set_uncacheable ()
int is_uncacheable ()
void set_unread ()
void set_read ()
int is_unread ()
int is_server_down ()
void server_down ()
int & counter ()
int count_inval (int a, int th)
int count_request (int b, int th)
void set_mpush (double time)
void clear_mpush ()
int is_mpush ()
double mpush_time ()
int size () const
int & id ()

Static Public Member Functions

void split_name (const char *name, PageID &id)
void print_name (char *name, PageID &id)

Static Public Attributes

int PUSHALL_ = 0

Protected Member Functions

void set_page_state (int state)
void clear_page_state (int state)
void set_page_action (int action)
void clear_page_action (int action)

Protected Attributes

HttpAppserver_
double age_
double mtime_
double etime_
int status_
int counter_
double mpushTime_
int size_
int id_

Constructor & Destructor Documentation

ClientPage::ClientPage const char *  n,
int  s,
double  mt,
double  et,
double  a
 

Definition at line 53 of file pagepool.cc.

References abort(), HTTP_VALID_PAGE, Page::id_, and server_.

00053                                                                            :
00054                 Page(s), age_(a), mtime_(mt), etime_(et), 
00055                 status_(HTTP_VALID_PAGE), counter_(0), 
00056                 mpushTime_(0)
00057 {
00058         // Parse name to get server and page id
00059         char *buf = new char[strlen(n) + 1];
00060         strcpy(buf, n);
00061         char *tmp = strtok(buf, ":");
00062         server_ = (HttpApp*)TclObject::lookup(tmp);
00063         if (server_ == NULL) {
00064                 fprintf(stderr, "Non-exitent server name for page %s", n);
00065                 abort();
00066         }
00067         tmp = strtok(NULL, ":");
00068         id_ = atol(tmp);
00069         delete []buf;
00070 }

Here is the call graph for this function:

virtual ClientPage::~ClientPage  )  [inline, virtual]
 

Definition at line 100 of file pagepool.h.

00100 {}


Member Function Documentation

double& ClientPage::age  )  [inline]
 

Definition at line 108 of file pagepool.h.

References age_.

Referenced by HttpUpdateData::PageRec::copy(), ClientPagePool::get_age(), and print_info().

00108 { return age_; }

void ClientPage::clear_mpush  )  [inline]
 

Definition at line 197 of file pagepool.h.

References clear_page_action(), and HTTP_MANDATORY_PUSH.

Referenced by HttpMInvalCache::command(), HttpYucInvalServer::command(), and HttpMInvalCache::recv_upd().

00197 { clear_page_action(HTTP_MANDATORY_PUSH); }

Here is the call graph for this function:

void ClientPage::clear_page_action int  action  )  [inline, protected]
 

Definition at line 215 of file pagepool.h.

References status_.

Referenced by clear_mpush().

00215                                            {
00216                 status_ = status_ & ~action;
00217         }

void ClientPage::clear_page_state int  state  )  [inline, protected]
 

Definition at line 209 of file pagepool.h.

References status_.

Referenced by invalidate(), server_down(), set_read(), set_valid_hdr(), and validate().

00209                                          {
00210                 status_ = status_ & ~state;
00211         }

int ClientPage::count_inval int  a,
int  th
[inline]
 

Definition at line 174 of file pagepool.h.

References counter_, and PUSHALL_.

Referenced by HttpYucInvalServer::command(), HttpMInvalCache::process_inv(), and HttpMInvalCache::recv_upd().

00174                                               { 
00175                 if (PUSHALL_) 
00176                         return INT_MAX;
00177                 else {
00178                         counter_ -= a; 
00179                         if (counter_ < th) 
00180                                 counter_ = th;
00181                         return counter_; 
00182                 }
00183         }

int ClientPage::count_request int  b,
int  th
[inline]
 

Definition at line 184 of file pagepool.h.

References counter_, and PUSHALL_.

Referenced by HttpMInvalCache::command(), and HttpYucInvalServer::command().

00184                                                 { 
00185                 if (PUSHALL_) 
00186                         return INT_MAX;
00187                 else {
00188                         counter_ += b; 
00189                         if (counter_ > th) 
00190                                 counter_ = th;
00191                         return counter_; 
00192                 }
00193         }

int& ClientPage::counter  )  [inline]
 

Definition at line 170 of file pagepool.h.

References counter_, and PUSHALL_.

Referenced by ClientPagePool::add_page(), HttpMInvalCache::command(), HttpYucInvalServer::command(), HttpMInvalCache::process_inv(), and HttpMInvalCache::recv_upd().

00170                               { 
00171                 if (PUSHALL_) counter_ = INT_MAX;
00172                 return counter_;
00173         }

double& ClientPage::etime  )  [inline]
 

Definition at line 107 of file pagepool.h.

References etime_.

Referenced by ClientPagePool::get_etime(), print_info(), and ClientPagePool::set_etime().

00107 { return etime_; }

int& Page::id  )  [inline, inherited]
 

Definition at line 38 of file pagepool.h.

References Page::id_.

Referenced by TracePagePool::add_page(), name(), and ServerPage::ServerPage().

00038 { return id_; }

void ClientPage::invalidate double  mtime  )  [inline]
 

Definition at line 120 of file pagepool.h.

References clear_page_state(), HTTP_VALID_HEADER, HTTP_VALID_PAGE, and mtime_.

Referenced by HttpMInvalCache::process_inv().

00120                                       { 
00121                 if (mtime_ >= mtime)
00122                         return;
00123                 clear_page_state(HTTP_VALID_PAGE);
00124                 clear_page_state(HTTP_VALID_HEADER);
00125                 mtime_ = mtime;
00126         }

Here is the call graph for this function:

int ClientPage::is_header_valid  )  const [inline]
 

Definition at line 130 of file pagepool.h.

References HTTP_VALID_HEADER, HTTP_VALID_PAGE, and status_.

Referenced by HttpPercInvalCache::command(), and HttpPercInvalCache::recv_inv_filter().

00130                                     {
00131                 return ((status_ & HTTP_VALID_PAGE) || 
00132                         (status_ & HTTP_VALID_HEADER));
00133         }

int ClientPage::is_mpush  )  [inline]
 

Definition at line 198 of file pagepool.h.

References HTTP_MANDATORY_PUSH, and status_.

Referenced by ClientPagePool::add_page(), HttpYucInvalServer::command(), and HttpMInvalCache::recv_upd().

00198 { return status_ & HTTP_MANDATORY_PUSH; }

int ClientPage::is_server_down  )  [inline]
 

Definition at line 158 of file pagepool.h.

References HTTP_SERVER_DOWN, and status_.

00158 { return (status_ & HTTP_SERVER_DOWN); }

int ClientPage::is_uncacheable  )  [inline]
 

Definition at line 144 of file pagepool.h.

References HTTP_UNCACHEABLE, and status_.

Referenced by print_info().

00144                                     {
00145                 return (status_ & HTTP_UNCACHEABLE);
00146         }

int ClientPage::is_unread  )  [inline]
 

Definition at line 156 of file pagepool.h.

References HTTP_UNREAD_PAGE, and status_.

Referenced by HttpMInvalCache::command().

00156 { return (status_ & HTTP_UNREAD_PAGE); }

int ClientPage::is_valid  )  const [inline]
 

Definition at line 127 of file pagepool.h.

References HTTP_VALID_PAGE, and status_.

Referenced by HttpApp::command(), and HttpMInvalCache::recv_inv_filter().

00127                              { 
00128                 return (status_ & HTTP_VALID_PAGE);
00129         }

double ClientPage::mpush_time  )  [inline]
 

Definition at line 199 of file pagepool.h.

References mpushTime_.

Referenced by ClientPagePool::add_page(), HttpYucInvalServer::command(), and HttpMInvalCache::recv_upd().

00199 { return mpushTime_; }

double& ClientPage::mtime  )  [inline]
 

Definition at line 106 of file pagepool.h.

References mtime_.

Referenced by HttpUpdateData::PageRec::copy(), ClientPagePool::get_mtime(), print_info(), HttpMInvalCache::process_inv(), HttpPercInvalCache::recv_inv_filter(), HttpMInvalCache::recv_inv_filter(), HttpMInvalCache::recv_upd(), and ClientPagePool::set_mtime().

00106 { return mtime_; }

void ClientPage::name char *  buf  ) 
 

Definition at line 100 of file pagepool.cc.

References Page::id(), and server_.

Referenced by ClientPagePool::add_page(), MClientPagePool::cache_replace(), HttpUpdateData::PageRec::copy(), MediaPage::evict_tail_segment(), HitCountList::print(), MClientPagePool::repl_atomic(), and MClientPagePool::repl_finegrain().

00101 {
00102         sprintf(buf, "%s:%d", server_->name(), id());
00103 }

Here is the call graph for this function:

void ClientPage::print_info char *  buf  )  [virtual]
 

Reimplemented in MediaPage.

Definition at line 92 of file pagepool.cc.

References age(), etime(), is_uncacheable(), mtime(), and Page::size().

Referenced by ClientPagePool::get_pageinfo(), and MediaPage::print_info().

00093 {
00094         sprintf(buf, "size %d modtime %.17g time %.17g age %.17g",
00095                 size(), mtime(), etime(), age());
00096         if (is_uncacheable())
00097                 strcat(buf, " noc 1");
00098 }

Here is the call graph for this function:

void ClientPage::print_name char *  name,
PageID id
[static]
 

Definition at line 72 of file pagepool.cc.

References PageID::id_, and PageID::s_.

00073 {
00074         sprintf(name, "%s:%-d", id.s_->name(), id.id_);
00075 }

HttpApp* ClientPage::server  )  [inline]
 

Definition at line 109 of file pagepool.h.

References server_.

Referenced by ClientPagePool::invalidate_server(), and HttpMInvalCache::process_inv().

00109 { return server_; }

void ClientPage::server_down  )  [inline]
 

Definition at line 159 of file pagepool.h.

References clear_page_state(), HTTP_SERVER_DOWN, HTTP_VALID_HEADER, HTTP_VALID_PAGE, and set_page_state().

Referenced by ClientPagePool::invalidate_server().

00159                                   {
00160                 // Set page as invalid
00161                 // Don't change mtime, only change page status
00162                 clear_page_state(HTTP_VALID_PAGE);
00163                 clear_page_state(HTTP_VALID_HEADER);
00164                 set_page_state(HTTP_SERVER_DOWN);
00165         }

Here is the call graph for this function:

void ClientPage::set_mpush double  time  )  [inline]
 

Definition at line 194 of file pagepool.h.

References HTTP_MANDATORY_PUSH, mpushTime_, and set_page_action().

Referenced by ClientPagePool::add_page(), HttpMInvalCache::command(), and HttpYucInvalServer::command().

00194                                            { 
00195                 set_page_action(HTTP_MANDATORY_PUSH), mpushTime_ = time; 
00196         }

Here is the call graph for this function:

void ClientPage::set_page_action int  action  )  [inline, protected]
 

Definition at line 212 of file pagepool.h.

References status_.

Referenced by set_mpush().

00212                                          {
00213                 status_ |= action;
00214         }

void ClientPage::set_page_state int  state  )  [inline, protected]
 

Definition at line 206 of file pagepool.h.

References status_.

Referenced by server_down(), set_uncacheable(), set_unread(), set_valid_hdr(), and validate().

00206                                        {
00207                 status_ |= state;
00208         }

void ClientPage::set_read  )  [inline]
 

Definition at line 153 of file pagepool.h.

References clear_page_state(), and HTTP_UNREAD_PAGE.

Referenced by HttpMInvalCache::command().

00153                                { 
00154                 clear_page_state(HTTP_UNREAD_PAGE);
00155         }

Here is the call graph for this function:

void ClientPage::set_uncacheable  )  [inline]
 

Definition at line 141 of file pagepool.h.

References HTTP_UNCACHEABLE, and set_page_state().

Referenced by ClientPagePool::enter_page(), and MClientPagePool::enter_page().

00141                                       { 
00142                 set_page_state(HTTP_UNCACHEABLE);
00143         }

Here is the call graph for this function:

void ClientPage::set_unread  )  [inline]
 

Definition at line 150 of file pagepool.h.

References HTTP_UNREAD_PAGE, and set_page_state().

Referenced by HttpMInvalCache::command(), and HttpMInvalCache::recv_upd().

00150                                  { 
00151                 set_page_state(HTTP_UNREAD_PAGE); 
00152         }

Here is the call graph for this function:

void ClientPage::set_valid_hdr  )  [inline]
 

Definition at line 134 of file pagepool.h.

References clear_page_state(), HTTP_SERVER_DOWN, HTTP_VALID_HEADER, HTTP_VALID_PAGE, and set_page_state().

Referenced by ClientPagePool::enter_metadata().

00134                                     { 
00135                 // XXX page invalid, but only header valid
00136                 clear_page_state(HTTP_SERVER_DOWN);
00137                 clear_page_state(HTTP_VALID_PAGE);
00138                 set_page_state(HTTP_VALID_HEADER); 
00139         }

Here is the call graph for this function:

int Page::size  )  const [inline, inherited]
 

Definition at line 37 of file pagepool.h.

References Page::size_.

Referenced by HttpUpdateData::add(), HttpUpdateData::PageRec::copy(), MClientPagePool::fill_page(), MClientPagePool::force_remove(), ClientPagePool::get_size(), Page::Page(), print_info(), and MClientPagePool::remove_page().

00037 { return size_; }

void ClientPage::split_name const char *  name,
PageID id
[static]
 

Definition at line 77 of file pagepool.cc.

References abort(), PageID::id_, and PageID::s_.

Referenced by ClientPagePool::add_page(), CompMathPagePool::command(), ClientPagePool::get_page(), MediaServer::get_piq(), and ClientPagePool::remove_page().

00078 {
00079         char *buf = new char[strlen(name)+1];
00080         strcpy(buf, name);
00081         char *tmp = strtok(buf, ":");
00082         id.s_ = (HttpApp*)TclObject::lookup(tmp);
00083         if (id.s_ == NULL) {
00084                 fprintf(stderr, "Non-exitent server name for page %s\n", name);
00085                 abort();
00086         }
00087         tmp = strtok(NULL, ":");
00088         id.id_ = atol(tmp);
00089         delete []buf;
00090 }

Here is the call graph for this function:

virtual WebPageType ClientPage::type  )  const [inline, virtual]
 

Implements Page.

Reimplemented in MediaPage.

Definition at line 102 of file pagepool.h.

References HTML, and WebPageType.

Referenced by MediaServer::command(), MediaCache::command(), HttpApp::command(), MClientPagePool::force_remove(), and MClientPagePool::remove_page().

00102 { return HTML; }

void ClientPage::validate double  mtime  )  [inline]
 

Definition at line 112 of file pagepool.h.

References abort(), clear_page_state(), HTTP_SERVER_DOWN, HTTP_VALID_PAGE, mtime_, and set_page_state().

00112                                     { 
00113                 if (mtime_ >= mtime)
00114                         abort(); // This shouldn't happen!
00115                 // Clear server down bit
00116                 clear_page_state(HTTP_SERVER_DOWN);
00117                 set_page_state(HTTP_VALID_PAGE);
00118                 mtime_ = mtime;
00119         }

Here is the call graph for this function:


Member Data Documentation

double ClientPage::age_ [protected]
 

Definition at line 220 of file pagepool.h.

Referenced by age().

int ClientPage::counter_ [protected]
 

Definition at line 224 of file pagepool.h.

Referenced by count_inval(), count_request(), and counter().

double ClientPage::etime_ [protected]
 

Definition at line 222 of file pagepool.h.

Referenced by etime().

int Page::id_ [protected, inherited]
 

Definition at line 43 of file pagepool.h.

Referenced by ClientPage(), Page::id(), and ServerPage::ServerPage().

double ClientPage::mpushTime_ [protected]
 

Definition at line 225 of file pagepool.h.

Referenced by mpush_time(), and set_mpush().

double ClientPage::mtime_ [protected]
 

Definition at line 221 of file pagepool.h.

Referenced by invalidate(), mtime(), and validate().

int ClientPage::PUSHALL_ = 0 [static]
 

Definition at line 43 of file pagepool.cc.

Referenced by PagePool::command(), count_inval(), count_request(), and counter().

HttpApp* ClientPage::server_ [protected]
 

Definition at line 219 of file pagepool.h.

Referenced by ClientPage(), name(), and server().

int Page::size_ [protected, inherited]
 

Definition at line 42 of file pagepool.h.

Referenced by MediaPage::create(), MediaPage::hit_layer(), Page::Page(), ServerPage::size(), and Page::size().

int ClientPage::status_ [protected]
 

Definition at line 223 of file pagepool.h.

Referenced by clear_page_action(), clear_page_state(), is_header_valid(), is_mpush(), is_server_down(), is_uncacheable(), is_unread(), is_valid(), set_page_action(), and set_page_state().


The documentation for this class was generated from the following files:
Generated on Tue Apr 20 12:35:43 2004 for NS2.26SourcesOriginal by doxygen 1.3.3