dht::search_handler Class Reference

Interface for handling DHT search results. More...

#include <dht/search_handler.h>

Inheritance diagram for dht::search_handler:

dht::notify_handler List of all members.

Public Member Functions

virtual int found (const dht::key &k, const dht::value &v)=0
 Called when a new search result has been obtained.
virtual void success (const dht::key &k)
 Called if search finished successfully.
virtual void failure (const dht::key &k, int error, const char *errstr)
 Called if search terminated because of an error.
virtual void success ()
 Called in case of success.
virtual void failure (int error, const char *errstr)
 Called in case of a failure.

Detailed Description

Interface for handling DHT search results.

Classes that implement this interface can receive and react to search result notifications from DHT implementations.


Member Function Documentation

virtual int dht::search_handler::found ( const dht::key k,
const dht::value v 
) [pure virtual]

Called when a new search result has been obtained.

Parameters:
k The key that was searched
v The value that was obtained
This function is called for each result that is found for the searched key. If the function returns non-zero, then no more search results for the search operation are returned. If 0 returned, operation continues as normal. Notice that if non-zero is returned, the success() and failure() routines will NOT be called.

The return value from this overrides any return value that might have been returned by an observer.

virtual void dht::search_handler::success ( const dht::key k  )  [virtual]

Called if search finished successfully.

Parameters:
k the key that was searched
Note that even if no results were found for the key, success will be called unless an abnormal error happened.

virtual void dht::search_handler::failure ( const dht::key k,
int  error,
const char *  errstr 
) [virtual]

Called if search terminated because of an error.

Parameters:
k the key that was searched
error an error code
errstr a NULL terminated string giving exact reason for the error

virtual void dht::search_handler::success (  )  [virtual]

Called in case of success.

Implements dht::notify_handler.

virtual void dht::search_handler::failure ( int  error,
const char *  errstr 
) [virtual]

Called in case of a failure.

Parameters:
error an error code
errstr a NULL terminated string giving exact reason for the error

Implements dht::notify_handler.


The documentation for this class was generated from the following file:
Generated on Thu Mar 1 16:18:47 2007 for libdht by  doxygen 1.5.1