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

NeighborCache Class Reference

#include <http-aux.h>

Collaboration diagram for NeighborCache:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 NeighborCache (HttpMInvalCache *c, double t, LivenessTimer *timer)
 ~NeighborCache ()
double time ()
void reset_timer (double time)
int is_down ()
void down ()
void up ()
int num () const
HttpMInvalCachecache ()
void pack_leave (HttpLeaveData &)
int is_server_down (int sid)
void server_down (int sid)
void server_up (int sid)
void invalidate (HttpMInvalCache *c)
void add_server (int sid)

Protected Attributes

HttpMInvalCachecache_
double time_
int down_
ServerList sl_
LivenessTimertimer_

Constructor & Destructor Documentation

NeighborCache::NeighborCache HttpMInvalCache c,
double  t,
LivenessTimer timer
[inline]
 

Definition at line 405 of file http-aux.h.

References cache_, down_, time_, and timer_.

00405                                                                          : 
00406                 cache_(c), time_(t), down_(0), timer_(timer) {}

NeighborCache::~NeighborCache  ) 
 

Definition at line 59 of file http-aux.cc.

References TimerHandler::cancel(), NeighborCache::ServerList::gethead(), NeighborCache::ServerEntry::next(), sl_, and timer_.

00060 {
00061         timer_->cancel();
00062         delete timer_;
00063         ServerEntry *s = sl_.gethead(), *p;
00064         while (s != NULL) {
00065                 p = s;
00066                 s = s->next();
00067                 delete p;
00068         }
00069 }

Here is the call graph for this function:


Member Function Documentation

void NeighborCache::add_server int  sid  ) 
 

Definition at line 119 of file http-aux.cc.

References NeighborCache::ServerList::insert(), and sl_.

Referenced by HttpMInvalCache::check_sstate().

00120 {
00121         ServerEntry *s = new ServerEntry(sid);
00122         sl_.insert(s);
00123 }

Here is the call graph for this function:

HttpMInvalCache* NeighborCache::cache  )  [inline]
 

Definition at line 417 of file http-aux.h.

References cache_.

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

00417 { return cache_; }

void NeighborCache::down  )  [inline]
 

Definition at line 414 of file http-aux.h.

References down_.

Referenced by HttpMInvalCache::handle_node_failure().

00414 { down_ = 1; }

void NeighborCache::invalidate HttpMInvalCache c  ) 
 

Definition at line 102 of file http-aux.cc.

References NeighborCache::ServerList::gethead(), HttpMInvalCache::invalidate_server(), NeighborCache::ServerEntry::next(), NeighborCache::ServerEntry::server(), and sl_.

Referenced by HttpMInvalCache::handle_node_failure().

00103 {
00104         ServerEntry *s = sl_.gethead();
00105         while (s != NULL) {
00106                 c->invalidate_server(s->server());
00107                 s = s->next();
00108         }
00109 }

Here is the call graph for this function:

int NeighborCache::is_down  )  [inline]
 

Definition at line 413 of file http-aux.h.

References down_.

Referenced by HttpMInvalCache::recv_heartbeat().

00413 { return down_; }

int NeighborCache::is_server_down int  sid  ) 
 

Definition at line 71 of file http-aux.cc.

References NeighborCache::ServerList::gethead(), NeighborCache::ServerEntry::is_down(), NeighborCache::ServerEntry::next(), NeighborCache::ServerEntry::server(), and sl_.

00072 {
00073         ServerEntry *s = sl_.gethead();
00074         while (s != NULL) {
00075                 if (s->server() == sid)
00076                         return s->is_down();
00077                 s = s->next();
00078         }
00079         return 0;
00080 }

Here is the call graph for this function:

int NeighborCache::num  )  const [inline]
 

Definition at line 416 of file http-aux.h.

References NeighborCache::ServerList::num(), and sl_.

Referenced by HttpMInvalCache::handle_node_failure().

00416 { return sl_.num(); }

Here is the call graph for this function:

void NeighborCache::pack_leave HttpLeaveData  ) 
 

Definition at line 111 of file http-aux.cc.

References HttpLeaveData::add(), NeighborCache::ServerList::gethead(), and sl_.

Referenced by HttpMInvalCache::handle_node_failure().

00112 {
00113         int i;
00114         ServerEntry *s;
00115         for (i = 0, s = sl_.gethead(); s != NULL; s = s->next(), i++)
00116                 data.add(i, s->server());
00117 }

Here is the call graph for this function:

void NeighborCache::reset_timer double  time  )  [inline]
 

Definition at line 410 of file http-aux.h.

References LivenessTimer::resched(), time_, and timer_.

Referenced by HttpMInvalCache::recv_heartbeat().

00410                                       { 
00411                 time_ = time, timer_->resched(); 
00412         }

Here is the call graph for this function:

void NeighborCache::server_down int  sid  ) 
 

Definition at line 82 of file http-aux.cc.

References NeighborCache::ServerEntry::down(), NeighborCache::ServerList::gethead(), NeighborCache::ServerEntry::next(), NeighborCache::ServerEntry::server(), and sl_.

00083 {
00084         ServerEntry *s = sl_.gethead();
00085         while (s != NULL) {
00086                 if (s->server() == sid)
00087                         s->down();
00088                 s = s->next();
00089         }
00090 }

Here is the call graph for this function:

void NeighborCache::server_up int  sid  ) 
 

Definition at line 92 of file http-aux.cc.

References NeighborCache::ServerList::gethead(), NeighborCache::ServerEntry::next(), NeighborCache::ServerEntry::server(), sl_, and NeighborCache::ServerEntry::up().

Referenced by HttpMInvalCache::check_sstate().

00093 {
00094         ServerEntry *s = sl_.gethead();
00095         while (s != NULL) {
00096                 if (s->server() == sid)
00097                         s->up();
00098                 s = s->next();
00099         }
00100 }

Here is the call graph for this function:

double NeighborCache::time  )  [inline]
 

Definition at line 409 of file http-aux.h.

References time_.

00409 { return time_; }

void NeighborCache::up  )  [inline]
 

Definition at line 415 of file http-aux.h.

References down_.

Referenced by HttpMInvalCache::recv_heartbeat().

00415 { down_ = 0; }


Member Data Documentation

HttpMInvalCache* NeighborCache::cache_ [protected]
 

Definition at line 454 of file http-aux.h.

Referenced by cache(), and NeighborCache().

int NeighborCache::down_ [protected]
 

Definition at line 456 of file http-aux.h.

Referenced by down(), is_down(), NeighborCache(), and up().

ServerList NeighborCache::sl_ [protected]
 

Definition at line 457 of file http-aux.h.

Referenced by add_server(), invalidate(), is_server_down(), num(), pack_leave(), server_down(), server_up(), and ~NeighborCache().

double NeighborCache::time_ [protected]
 

Definition at line 455 of file http-aux.h.

Referenced by NeighborCache(), reset_timer(), and time().

LivenessTimer* NeighborCache::timer_ [protected]
 

Definition at line 458 of file http-aux.h.

Referenced by NeighborCache(), reset_timer(), and ~NeighborCache().


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