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

kget

dht::Task

dht::Task Class Reference

#include <task.h>

Inheritance diagram for dht::Task:

Inheritance graph
[legend]

List of all members.


Detailed Description

Author:
Joris Guisson <joris.guisson@gmail.com>

Performs a task on K nodes provided by a KClosestNodesSearch. This is a base class for all tasks.

Definition at line 48 of file task.h.


Signals

void dataReady (Task *t)
void finished (Task *t)

Public Member Functions

void addDHTNode (const QString &ip, bt::Uint16 port)
virtual void callFinished (RPCCall *c, MsgBase *rsp)=0
virtual void callTimeout (RPCCall *c)=0
bool canDoRequest () const
void emitDataReady ()
bt::Uint32 getNumOutstandingRequests () const
bt::Uint32 getTaskID () const
bool isFinished () const
bool isQueued () const
void kill ()
virtual void onResponse (RPCCall *c, MsgBase *rsp)
virtual void onTimeout (RPCCall *c)
bool rpcCall (MsgBase *req)
void setTaskID (bt::Uint32 tid)
void start ()
void start (const KClosestNodesSearch &kns, bool queued)
 Task (RPCServer *rpc, Node *node)
virtual void update ()=0
virtual ~Task ()

Protected Slots

void onResolverResults (KNetwork::KResolverResults res)

Protected Member Functions

void done ()

Protected Attributes

Node * node
QList< KBucketEntry > todo
QList< KBucketEntry > visited

Constructor & Destructor Documentation

dht::Task::Task ( RPCServer *  rpc,
Node *  node 
)

Create a task.

Parameters:
rpc The RPC server to do RPC calls
node The node

Definition at line 31 of file task.cpp.

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

Definition at line 38 of file task.cpp.


Member Function Documentation

void dht::Task::addDHTNode ( const QString &  ip,
bt::Uint16  port 
)

Add a node to the todo list.

Parameters:
ip The ip or hostname of the node
port The port

Definition at line 118 of file task.cpp.

virtual void dht::Task::callFinished ( RPCCall *  c,
MsgBase *  rsp 
) [pure virtual]

A call is finished and a response was received.

Parameters:
c The call
rsp The response

Implemented in dht::AnnounceTask, and dht::NodeLookup.

virtual void dht::Task::callTimeout ( RPCCall *  c  )  [pure virtual]

A call timedout.

Parameters:
c The call

Implemented in dht::AnnounceTask, and dht::NodeLookup.

bool dht::Task::canDoRequest (  )  const [inline]

See if we can do a request.

Definition at line 107 of file task.h.

void dht::Task::dataReady ( Task *  t  )  [signal]

Called by the task when data is ready.

Can be overrided if wanted.

Parameters:
t The Task

void dht::Task::done (  )  [protected]

Definition at line 101 of file task.cpp.

void dht::Task::emitDataReady (  ) 

Tell listeners data is ready.

Definition at line 107 of file task.cpp.

void dht::Task::finished ( Task *  t  )  [signal]

The task is finsihed.

Parameters:
t The Task

bt::Uint32 dht::Task::getNumOutstandingRequests (  )  const [inline]

Get the number of outstanding requests.

Definition at line 119 of file task.h.

bt::Uint32 dht::Task::getTaskID (  )  const [inline]

Get the task ID.

Definition at line 116 of file task.h.

bool dht::Task::isFinished (  )  const [inline]

Is the task finished.

Definition at line 110 of file task.h.

bool dht::Task::isQueued (  )  const [inline]

Definition at line 121 of file task.h.

void dht::Task::kill (  ) 

Kills the task.

Definition at line 112 of file task.cpp.

void dht::Task::onResolverResults ( KNetwork::KResolverResults  res  )  [protected, slot]

void dht::Task::onResponse ( RPCCall *  c,
MsgBase *  rsp 
) [virtual]

Decrements the outstanding_reqs.

Implements dht::RPCCallListener.

Definition at line 62 of file task.cpp.

void dht::Task::onTimeout ( RPCCall *  c  )  [virtual]

Decrements the outstanding_reqs.

Implements dht::RPCCallListener.

Definition at line 76 of file task.cpp.

bool dht::Task::rpcCall ( MsgBase *  req  ) 

Do a call to the rpc server, increments the outstanding_reqs variable.

Parameters:
req THe request to send
Returns:
true if call was made, false if not

Definition at line 90 of file task.cpp.

void dht::Task::setTaskID ( bt::Uint32  tid  )  [inline]

Set the task ID.

Definition at line 113 of file task.h.

void dht::Task::start (  ) 

Start the task, to be used when a task is queued.

Definition at line 52 of file task.cpp.

void dht::Task::start ( const KClosestNodesSearch &  kns,
bool  queued 
)

This will copy the results from the KClosestNodesSearch object into the todo list.

And call update if the task is not queued.

Parameters:
kns The KClosestNodesSearch object
queued Is the task queued

Definition at line 42 of file task.cpp.

virtual void dht::Task::update (  )  [pure virtual]

Will continue the task, this will be called every time we have rpc slots available for this task.

Should be implemented by derived classes.

Implemented in dht::AnnounceTask, and dht::NodeLookup.


Member Data Documentation

Node* dht::Task::node [protected]

Definition at line 161 of file task.h.

QList<KBucketEntry> dht::Task::todo [protected]

Definition at line 160 of file task.h.

QList<KBucketEntry> dht::Task::visited [protected]

Definition at line 159 of file task.h.


The documentation for this class was generated from the following files:
  • task.h
  • task.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