Gnutella::Bootstrapping::NodeCache Class Reference

#include <NodeCache.h> [code]

Inherits QObject.

Inheritance diagram for Gnutella::Bootstrapping::NodeCache:

Inheritance graph
[legend]
Collaboration diagram for Gnutella::Bootstrapping::NodeCache:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 36 of file NodeCache.h.

Public Types

enum  NodeAvailability {
  UnknownAvailability,
  CheckingAvailability,
  NodeAvailable,
  NodeBusy,
  NodeUnavailable,
  AvailabilityCount
}
 Enumerates the different host availabilities. More...

Signals

void nodeAdded ()

Public Member Functions

 NodeCache ()
 ~NodeCache ()
bool loadNodes (const QString &filename)
bool storeNodes (const QString &filename)
void addNode (const NodeInfo &, NodeAvailability)
void updateNode (const NodeAddress &, NodeAvailability)
NodeSet getNodes (int count, NodeAvailability, bool freshNodes)
template<typename Pred>
NodeSet getNodes (int count, NodeAvailability availability, bool freshNodes, const Pred &pred)

Private Member Functions

 NodeCache (const NodeCache &)
NodeCacheoperator= (const NodeCache &)
NodeSet getNodes (int count, NodeAvailability availability, bool freshNodes, const Predicate &pred)

Private Attributes

NodeCachePrivated

Classes

class  Predicate


Member Enumeration Documentation

enum Gnutella::Bootstrapping::NodeCache::NodeAvailability
 

Enumerates the different host availabilities.

Note:
The order in which the availabilites are defined defines the order in which they can be overwritten in the NodeCache. For example, assume that we try to add a host to the cache but we already added it two minutes ago. If the new information tells us that the host is available, but two minutes ago we checked it and saw it is unavailable, then the new info should be ignored and the old kept. So if the availability is smaller, do not do the update. Only update if availability is equal or greater than the last saved one.
See also:
NodeCache
Enumerator:
UnknownAvailability  We have received info about a host but have not verified it yet.
CheckingAvailability  We are trying to establish a connection with the host.
NodeAvailable  We succeeded in establishing a connection with the node.
NodeBusy  Connection was established but the host was busy.
NodeUnavailable  Failed to establish a connection.
AvailabilityCount  The number of different availabilites.

Definition at line 56 of file NodeCache.h.


Constructor & Destructor Documentation

Gnutella::Bootstrapping::NodeCache::NodeCache const NodeCache  )  [private]
 

NodeCache::NodeCache  ) 
 

Definition at line 88 of file NodeCache.cpp.

NodeCache::~NodeCache  ) 
 

Definition at line 93 of file NodeCache.cpp.


Member Function Documentation

void NodeCache::addNode const NodeInfo ,
NodeAvailability 
 

Definition at line 118 of file NodeCache.cpp.

NodeSet NodeCache::getNodes int  count,
NodeAvailability  availability,
bool  freshNodes,
const Predicate pred
[private]
 

Todo:
It still happens to have two connections to the SAME host! More absurdly, this host was we ourselves!!! How did it happen that the host cache returned two times the same host??

Definition at line 185 of file NodeCache.cpp.

template<typename Pred>
NodeSet Gnutella::Bootstrapping::NodeCache::getNodes int  count,
NodeAvailability  availability,
bool  freshNodes,
const Pred &  pred
 

Definition at line 95 of file NodeCache.h.

NodeSet NodeCache::getNodes int  count,
NodeAvailability  ,
bool  freshNodes
 

Definition at line 98 of file NodeCache.cpp.

bool NodeCache::loadNodes const QString &  filename  ) 
 

Definition at line 201 of file NodeCache.cpp.

void Gnutella::Bootstrapping::NodeCache::nodeAdded  )  [signal]
 

NodeCache& Gnutella::Bootstrapping::NodeCache::operator= const NodeCache  )  [private]
 

bool NodeCache::storeNodes const QString &  filename  ) 
 

Definition at line 230 of file NodeCache.cpp.

void NodeCache::updateNode const NodeAddress ,
NodeAvailability 
 

Definition at line 153 of file NodeCache.cpp.


Member Data Documentation

NodeCachePrivate* Gnutella::Bootstrapping::NodeCache::d [private]
 

Definition at line 91 of file NodeCache.h.


The documentation for this class was generated from the following files: