Sirikata
|
A ServerIDMap which looks up servers with Http requests. More...
#include <HttpServerIDMap.hpp>
Classes | |
struct | RequestInfo |
Public Member Functions | |
HttpServerIDMap (Context *ctx, const String &internal_host, const String &internal_service, const String &internal_path, const String &external_host, const String &external_service, const String &external_path, uint32 retries) | |
virtual | ~HttpServerIDMap () |
virtual void | lookupInternal (const ServerID &sid, Address4LookupCallback cb) |
Lookup for internal addresses, i.e. | |
virtual void | lookupExternal (const ServerID &sid, Address4LookupCallback cb) |
Lookup for external addresses, i.e. | |
virtual void | lookupRandomExternal (Address4LookupCallback cb) |
Lookup a random external addres, e.g. | |
Private Member Functions | |
void | startLookup (const RequestInfo &ri, const uint32 retry) |
void | finishLookup (const RequestInfo &ri, const uint32 retry, Transfer::HttpManager::HttpResponsePtr response, Transfer::HttpManager::ERR_TYPE error, const boost::system::error_code &boost_error) |
bool | retryOrFail (const RequestInfo &ri, const uint32 retry) |
Private Attributes | |
const String | mInternalHost |
const String | mInternalService |
const String | mInternalPath |
const String | mExternalHost |
const String | mExternalService |
const String | mExternalPath |
const uint32 | mRetries |
A ServerIDMap which looks up servers with Http requests.
Currently the implementation does a simple GET request with a query parameter "server" with a numeric value for the server ID to lookup.
Sirikata::HttpServerIDMap::HttpServerIDMap | ( | Context * | ctx, |
const String & | internal_host, | ||
const String & | internal_service, | ||
const String & | internal_path, | ||
const String & | external_host, | ||
const String & | external_service, | ||
const String & | external_path, | ||
uint32 | retries | ||
) |
virtual Sirikata::HttpServerIDMap::~HttpServerIDMap | ( | ) | [inline, virtual] |
void Sirikata::HttpServerIDMap::finishLookup | ( | const RequestInfo & | ri, |
const uint32 | retry, | ||
Transfer::HttpManager::HttpResponsePtr | response, | ||
Transfer::HttpManager::ERR_TYPE | error, | ||
const boost::system::error_code & | boost_error | ||
) | [private] |
void Sirikata::HttpServerIDMap::lookupExternal | ( | const ServerID & | sid, |
Address4LookupCallback | cb | ||
) | [virtual] |
Lookup for external addresses, i.e.
those used for object host to space server communication. Returns NullServerID or Address4::Null if the server can't be found.
Implements Sirikata::ServerIDMap.
References mExternalHost, mExternalPath, mExternalService, and startLookup().
void Sirikata::HttpServerIDMap::lookupInternal | ( | const ServerID & | sid, |
Address4LookupCallback | cb | ||
) | [virtual] |
Lookup for internal addresses, i.e.
those used for space server to space server communication. Returns NullServerID or Address4::Null if the server can't be found.
Implements Sirikata::ServerIDMap.
References mInternalHost, mInternalPath, mInternalService, and startLookup().
void Sirikata::HttpServerIDMap::lookupRandomExternal | ( | Address4LookupCallback | cb | ) | [virtual] |
Lookup a random external addres, e.g.
to find any node to bootstrap a connection to the space.
Implements Sirikata::ServerIDMap.
References mExternalHost, mExternalPath, mExternalService, and startLookup().
bool Sirikata::HttpServerIDMap::retryOrFail | ( | const RequestInfo & | ri, |
const uint32 | retry | ||
) | [private] |
void Sirikata::HttpServerIDMap::startLookup | ( | const RequestInfo & | ri, |
const uint32 | retry | ||
) | [private] |
References finishLookup(), Sirikata::Transfer::HttpManager::get(), Sirikata::Transfer::HttpManager::getSingleton(), Sirikata::HttpServerIDMap::RequestInfo::host, Sirikata::HttpServerIDMap::RequestInfo::path, Sirikata::HttpServerIDMap::RequestInfo::service, and Sirikata::HttpServerIDMap::RequestInfo::sid.
Referenced by lookupExternal(), lookupInternal(), lookupRandomExternal(), and retryOrFail().
const String Sirikata::HttpServerIDMap::mExternalHost [private] |
Referenced by lookupExternal(), and lookupRandomExternal().
const String Sirikata::HttpServerIDMap::mExternalPath [private] |
Referenced by lookupExternal(), and lookupRandomExternal().
const String Sirikata::HttpServerIDMap::mExternalService [private] |
Referenced by lookupExternal(), and lookupRandomExternal().
const String Sirikata::HttpServerIDMap::mInternalHost [private] |
Referenced by lookupInternal().
const String Sirikata::HttpServerIDMap::mInternalPath [private] |
Referenced by lookupInternal().
const String Sirikata::HttpServerIDMap::mInternalService [private] |
Referenced by lookupInternal().
const uint32 Sirikata::HttpServerIDMap::mRetries [private] |
Referenced by retryOrFail().