Classified ads
Public Slots | Signals | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
RetrievalEngine Class Reference

Network-connection logic relating fetching items from DHT. More...

#include <retrievalengine.h>

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

Public Slots

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

Signals

void error (QTcpSocket::SocketError socketError)
 
void notifyOfContentNotReceived (const Hash &aHashOfContent, const ProtocolItemType aTypeOfNotReceivdContent)
 

Public Member Functions

 RetrievalEngine (Controller *aController, Model &aModel)
 
 ~RetrievalEngine ()
 
void startRetrieving (NetworkRequestExecutor::NetworkRequestQueueItem aObject, bool aIsPriorityWork)
 
void notifyOfContentReceived (const Hash &aHashOfContent, const ProtocolItemType aTypeOfReceivdContent)
 

Public Attributes

bool iNeedsToRun
 

Private Member Functions

void emptyNodeCandidateList ()
 
void askConnectionsForNodesOnConnectList ()
 
void sendQueryItemToAlreadyConnectedNodes ()
 
void sendQueryToNode (const Hash &aNode)
 
void checkForSuccessfullyConnectedNodes ()
 
void checkForUnSuccessfullyConnectedNodes ()
 

Private Attributes

ControlleriController
 
ModeliModel
 
NetworkRequestExecutor::NetworkRequestQueueItem iObjectBeingRetrieved
 
QList< HashiNodeCandidatesToTryQuery
 
QList< HashiNodesSuccessfullyConnected
 
QList< HashiNodesFailurefullyConnected
 
bool iNowRunning
 
QList< NetworkRequestExecutor::NetworkRequestQueueItemiDownloadQueue
 

Detailed Description

Network-connection logic relating fetching items from DHT.

This class has some similarity to PublishingEngine but this does somewhat the reverse. This is given a hash of object to find from network ; in order to so, it will initiate connections nearby nodes and ask for the content in-demand.

Constructor & Destructor Documentation

RetrievalEngine::RetrievalEngine ( Controller aController,
Model aModel 
)

Constructor

Parameters
aControllerapplication controller. not owned
aModelpersistent storage.
RetrievalEngine::~RetrievalEngine ( )

Destructor

Member Function Documentation

void RetrievalEngine::askConnectionsForNodesOnConnectList ( )
private
void RetrievalEngine::checkForSuccessfullyConnectedNodes ( )
private
void RetrievalEngine::checkForUnSuccessfullyConnectedNodes ( )
private
void RetrievalEngine::emptyNodeCandidateList ( )
private
void RetrievalEngine::error ( QTcpSocket::SocketError  socketError)
signal
void RetrievalEngine::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

void RetrievalEngine::notifyOfContentNotReceived ( const Hash aHashOfContent,
const ProtocolItemType  aTypeOfNotReceivdContent 
)
signal
void RetrievalEngine::notifyOfContentReceived ( const Hash aHashOfContent,
const ProtocolItemType  aTypeOfReceivdContent 
)

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

void RetrievalEngine::run ( )
slot

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

void RetrievalEngine::sendQueryItemToAlreadyConnectedNodes ( )
private
void RetrievalEngine::sendQueryToNode ( const Hash aNode)
private
void RetrievalEngine::startRetrieving ( NetworkRequestExecutor::NetworkRequestQueueItem  aObject,
bool  aIsPriorityWork 
)

command-interface for this class: start to do work

Parameters
aObjectspecifies the object to dl.
aIsPriorityWorkis set to true if download should start right away, bypassing all other stuff that might be in the queue

Member Data Documentation

Controller* RetrievalEngine::iController
private

application controller

QList<NetworkRequestExecutor::NetworkRequestQueueItem> RetrievalEngine::iDownloadQueue
private

queue of items that we should get

Model& RetrievalEngine::iModel
private

persistent storage

bool RetrievalEngine::iNeedsToRun

when this is set to false, thread will terminate and run() return

QList<Hash> RetrievalEngine::iNodeCandidatesToTryQuery
private

list of nodes where iWorkItem might be pushed to

QList<Hash> RetrievalEngine::iNodesFailurefullyConnected
private
QList<Hash> RetrievalEngine::iNodesSuccessfullyConnected
private
bool RetrievalEngine::iNowRunning
private
NetworkRequestExecutor::NetworkRequestQueueItem RetrievalEngine::iObjectBeingRetrieved
private

what kind of stuff we try. ..this class waits for exactly one item at time. item currently being fetched is stored in this variable


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