Classified ads
Classes | Public Slots | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
DbRecordRetrievalEngine Class Reference

Network-connection logic relating fetching db records from DHT. More...

#include <dbretrievalengine.h>

Inheritance diagram for DbRecordRetrievalEngine:
Inheritance graph
[legend]
Collaboration diagram for DbRecordRetrievalEngine:
Collaboration graph
[legend]

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

ControlleriController
 
ModeliModel
 
bool iNowRunning
 
QList< HashiNodeCandidatesToTryQuery
 
QList< HashiNodesSuccessfullyConnected
 
QList< HashiNodesFailurefullyConnected
 
QList< DlQueueItemiSearchTerms
 

Detailed Description

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.

Member Typedef Documentation

◆ DlQueueItem

Type definition for download queue items. See iSearchTerms

Constructor & Destructor Documentation

◆ DbRecordRetrievalEngine()

DbRecordRetrievalEngine::DbRecordRetrievalEngine ( Controller aController,
Model aModel 
)

Constructor

Parameters
aControllerapplication controller. not owned.
aModelpersistent storage.

◆ ~DbRecordRetrievalEngine()

DbRecordRetrievalEngine::~DbRecordRetrievalEngine ( )

Destructor

Member Function Documentation

◆ nodeConnectionAttemptStatus

void DbRecordRetrievalEngine::nodeConnectionAttemptStatus ( Connection::ConnectionState  aStatus,
const Hash  aHashOfAttemptedNode 
)
slot

when connection is attempted, NetworkListener will emit the status (failed or success) of the connection, emitted signal is connected here

◆ notifyOfContentReceived

void DbRecordRetrievalEngine::notifyOfContentReceived ( const Hash aHashOfContent,
const ProtocolItemType  aTypeOfReceivedContent 
)
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

◆ run

void DbRecordRetrievalEngine::run ( )
slot

this class is a not a thread, but QTimer, thus run.

◆ sendQueryToNode()

void DbRecordRetrievalEngine::sendQueryToNode ( const CaDbRecord::SearchTerms aSearchTerms,
const Hash aNodeFingerPrint 
)
private

◆ startRetrieving()

void DbRecordRetrievalEngine::startRetrieving ( CaDbRecord::SearchTerms  aSearchTerms)

command-interface for this class: start to do work

Parameters
aSearchTermsspecifies the database records to dl.

◆ stopRetrieving

void DbRecordRetrievalEngine::stopRetrieving ( )
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.

Member Data Documentation

◆ iController

Controller* DbRecordRetrievalEngine::iController
private

application controller

◆ iModel

Model& DbRecordRetrievalEngine::iModel
private

persistent storage

◆ iNodeCandidatesToTryQuery

QList<Hash> DbRecordRetrievalEngine::iNodeCandidatesToTryQuery
private

◆ iNodesFailurefullyConnected

QList<Hash> DbRecordRetrievalEngine::iNodesFailurefullyConnected
private

◆ iNodesSuccessfullyConnected

QList<Hash> DbRecordRetrievalEngine::iNodesSuccessfullyConnected
private

◆ iNowRunning

bool DbRecordRetrievalEngine::iNowRunning
private

◆ iSearchTerms

QList<DlQueueItem> DbRecordRetrievalEngine::iSearchTerms
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


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