• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdenetwork
  • Sitemap
  • Contact Us
 

kget

dht::Database

dht::Database Class Reference

#include <database.h>

List of all members.


Detailed Description

Author:
Joris Guisson

Class where all the key value paires get stored.

Definition at line 76 of file database.h.


Public Member Functions

bool checkToken (const dht::Key &token, const KNetwork::KInetSocketAddress &addr)
bool contains (const dht::Key &key) const
 Database ()
void expire (bt::TimeStamp now)
dht::Key genToken (const KNetwork::KInetSocketAddress &addr)
void insert (const dht::Key &key)
void sample (const dht::Key &key, DBItemList &dbl, bt::Uint32 max_entries)
void store (const dht::Key &key, const DBItem &dbi)
virtual ~Database ()

Constructor & Destructor Documentation

dht::Database::Database (  ) 

Definition at line 79 of file database.cpp.

dht::Database::~Database (  )  [virtual]

Definition at line 85 of file database.cpp.


Member Function Documentation

bool dht::Database::checkToken ( const dht::Key &  token,
const KNetwork::KInetSocketAddress &  addr 
)

Check if a received token is OK.

Parameters:
token The token received
addr The address of the peer
Returns:
true if the token was given to this peer, false other wise

Definition at line 177 of file database.cpp.

bool dht::Database::contains ( const dht::Key &  key  )  const

Test whether or not the DB contains a key.

Definition at line 227 of file database.cpp.

void dht::Database::expire ( bt::TimeStamp  now  ) 

Expire all items older then 30 minutes.

Parameters:
now The time it is now (we pass this along so we only have to calculate it once)

Definition at line 127 of file database.cpp.

dht::Key dht::Database::genToken ( const KNetwork::KInetSocketAddress &  addr  ) 

Generate a write token, which will give peers write access to the DB.

Parameters:
addr The address of the peer
Returns:
A Key

Definition at line 143 of file database.cpp.

void dht::Database::insert ( const dht::Key &  key  ) 

Insert an empty item (only if it isn't already in the DB).

Definition at line 232 of file database.cpp.

void dht::Database::sample ( const dht::Key &  key,
DBItemList &  dbl,
bt::Uint32  max_entries 
)

Get max_entries items from the database, which have the same key, items are taken randomly from the list.

If the key is not present no items will be returned, if there are fewer then max_entries items for the key, all entries will be returned

Parameters:
key The key to search for
dbl The list to store the items in
max_entries The maximum number entries

Definition at line 99 of file database.cpp.

void dht::Database::store ( const dht::Key &  key,
const DBItem &  dbi 
)

Store an entry in the database.

Parameters:
key The key
dbi The DBItem to store

Definition at line 88 of file database.cpp.


The documentation for this class was generated from the following files:
  • database.h
  • database.cpp

kget

Skip menu "kget"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdenetwork

Skip menu "kdenetwork"
  • kget
  • kopete
  •   kopete
  •   libkopete
  •       libpapillon
  • krfb
Generated for kdenetwork by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal