Classified ads
|
Network-connection logic relating fetching db records from DHT. More...
#include <dbretrievalengine.h>
Classes | |
struct | DlQueueItemStruct |
Public Slots | |
void | stopRetrieving () |
void | notifyOfContentReceived (const Hash &aHashOfContent, const ProtocolItemType aTypeOfReceivedContent) |
void | nodeConnectionAttemptStatus (Connection::ConnectionState aStatus, const Hash aHashOfAttemptedNode) |
void | run () |
Public Member Functions | |
DbRecordRetrievalEngine (Controller *aController, Model &aModel) | |
~DbRecordRetrievalEngine () | |
void | startRetrieving (CaDbRecord::SearchTerms aSearchTerms) |
Private Types | |
typedef struct DbRecordRetrievalEngine::DlQueueItemStruct | DlQueueItem |
Private Member Functions | |
void | sendQueryToNode (const CaDbRecord::SearchTerms &aSearchTerms, const Hash &aNodeFingerPrint) |
Private Attributes | |
Controller * | iController |
Model & | iModel |
bool | iNowRunning |
QList< Hash > | iNodeCandidatesToTryQuery |
QList< Hash > | iNodesSuccessfullyConnected |
QList< Hash > | iNodesFailurefullyConnected |
QList< DlQueueItem > | iSearchTerms |
Network-connection logic relating fetching db records from DHT.
Special retrieval logic for records of distributed db records only. See also RetrievalEngine that is used to fetch classified ads or binary files. RetrievalEngine is limited to fetching one item at time, with db records we may have multiple collections open at the same time and it may be necessary to fetch from all of those, and at the same time honouring possible search terms that user may have given.
Method is called via controller due to users activity usually inside TCL program. If conditions are met, this class locates nodes in the network that store the desired collection and repeates the query to those nodes in hope to retrieve more records matching the query.
|
private |
Type definition for download queue items. See iSearchTerms
DbRecordRetrievalEngine::DbRecordRetrievalEngine | ( | Controller * | aController, |
Model & | aModel | ||
) |
Constructor
aController | application controller. not owned. |
aModel | persistent storage. |
DbRecordRetrievalEngine::~DbRecordRetrievalEngine | ( | ) |
Destructor
|
slot |
when connection is attempted, NetworkListener will emit the status (failed or success) of the connection, emitted signal is connected here
|
slot |
when content is received, we may want to check if it was the content we were waiting for. this method is for performing that check
|
slot |
this class is a not a thread, but QTimer, thus run.
|
private |
void DbRecordRetrievalEngine::startRetrieving | ( | CaDbRecord::SearchTerms | aSearchTerms | ) |
command-interface for this class: start to do work
aSearchTerms | specifies the database records to dl. |
|
slot |
Command-interface for this class: cancel all ongoing retrievals. This gets connected to "finished" signal of the tcl interpreter: when program stops, it makes no more sense to serve it with db requests.
|
private |
application controller
|
private |
persistent storage
|
private |
|
private |
|
private |
|
private |
|
private |
List of records to try retrieve. In pair inside the list the "first" item is actual search condidtions, second is list of node fingerprints that have already received the search query ; so it won't be sent again