#include <database.h>
- Author
- Joris Guisson
Class where all the key value paires get stored.
Definition at line 78 of file database.h.
◆ checkToken()
bool dht::Database::checkToken |
( |
const QByteArray & |
token, |
|
|
const net::Address & |
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
◆ expire()
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) |
◆ genToken()
QByteArray dht::Database::genToken |
( |
const net::Address & |
addr | ) |
|
Generate a write token, which will give peers write access to the DB.
- Parameters
-
addr | The address of the peer |
- Returns
- A QByteArray
◆ sample()
void dht::Database::sample |
( |
const dht::Key & |
key, |
|
|
DBItemList & |
dbl, |
|
|
bt::Uint32 |
max_entries, |
|
|
bt::Uint32 |
ip_version |
|
) |
| |
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 |
ip_version | Wanted IP version (4 or 6) |
◆ store()
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 |
The documentation for this class was generated from the following file: