Sirikata
|
#include <asyncConnectionSet.hpp>
Classes | |
struct | IndividualQueryData |
Public Types | |
enum | ConnectionState { READY, NEED_NEW_SOCKET, PROCESSING } |
Public Member Functions | |
void | initialize (Sirikata::Network::TCPSocket *socket, boost::asio::ip::tcp::resolver::iterator) |
AsyncConnectionSet::ConnectionState | ready () |
void | setBound (const CraqObjectID &obj_dataToGet, const CraqEntry &dataToSetTo, const bool &track, const int &trackNum) |
void | set (const CraqDataKey &dataToSet, const CraqEntry &dataToSetTo, const bool &track, const int &trackNum) |
~AsyncConnectionSet () | |
AsyncConnectionSet (SpaceContext *con, Network::IOStrand *str, Network::IOStrand *error_strand, Network::IOStrand *result_strand, AsyncCraqScheduler *master, CraqObjectSegmentation *oseg, const std::tr1::function< void()> &readySetChanged) | |
int | numStillProcessing () |
void | stop () |
void | setProcessing () |
sets the ready state to be in the processing mode, meaning work has been posted to its strand | |
Private Types | |
typedef std::multimap < std::string, IndividualQueryData * > | MultiOutstandingQueries |
Private Member Functions | |
void | killSequence () |
void | set_generic_read_result_handler () |
void | set_generic_read_error_handler () |
bool | processEntireResponse (std::string response) |
void | processStoredValue (std::string dataKey) |
bool | parseStoredValue (const std::string &response, std::string &dataKey) |
bool | checkStored (std::string &response) |
bool | checkError (std::string &response) |
size_t | smallestIndex (std::vector< size_t > sizeVec) |
void | clear_all_deadline_timers () |
void | queryTimedOutCallbackSet (const boost::system::error_code &e, IndividualQueryData *iqd) |
void | connect_handler (const boost::system::error_code &error) |
void | generic_read_stored_not_found_error_handler (const boost::system::error_code &error, std::size_t bytes_transferred, boost::asio::streambuf *sBuff) |
void | set_generic_stored_not_found_error_handler () |
void | read_handler_set (const boost::system::error_code &error, std::size_t bytes_transferred, boost::asio::streambuf *sBuff) |
void | write_some_handler_set (const boost::system::error_code &error, std::size_t bytes_transferred) |
Private Attributes | |
Sirikata::Network::TCPSocket * | mSocket |
MultiOutstandingQueries | allOutstandingQueries |
SpaceContext * | ctx |
Network::IOStrand * | mStrand |
Network::IOStrand * | mErrorStrand |
Network::IOStrand * | mResultsStrand |
AsyncCraqScheduler * | mSchedulerMaster |
CraqObjectSegmentation * | mOSeg |
volatile ConnectionState | mReady |
std::string | mPrevReadFrag |
bool | mReceivedStopRequest |
std::tr1::function< void()> | mReadyStateChangedCallback |
typedef std::multimap<std::string, IndividualQueryData*> Sirikata::AsyncConnectionSet::MultiOutstandingQueries [private] |
Sirikata::AsyncConnectionSet::~AsyncConnectionSet | ( | ) |
References allOutstandingQueries, mSocket, and NEED_NEW_SOCKET.
Sirikata::AsyncConnectionSet::AsyncConnectionSet | ( | SpaceContext * | con, |
Network::IOStrand * | str, | ||
Network::IOStrand * | error_strand, | ||
Network::IOStrand * | result_strand, | ||
AsyncCraqScheduler * | master, | ||
CraqObjectSegmentation * | oseg, | ||
const std::tr1::function< void()> & | readySetChanged | ||
) |
References mReady, and NEED_NEW_SOCKET.
bool Sirikata::AsyncConnectionSet::checkError | ( | std::string & | response | ) | [private] |
bool Sirikata::AsyncConnectionSet::checkStored | ( | std::string & | response | ) | [private] |
void Sirikata::AsyncConnectionSet::clear_all_deadline_timers | ( | ) | [private] |
References allOutstandingQueries.
Referenced by stop().
void Sirikata::AsyncConnectionSet::connect_handler | ( | const boost::system::error_code & | error | ) | [private] |
References mErrorStrand, mReady, mReadyStateChangedCallback, mReceivedStopRequest, mSocket, NEED_NEW_SOCKET, Sirikata::Network::IOStrand::post(), READY, and set_generic_stored_not_found_error_handler().
Referenced by initialize().
void Sirikata::AsyncConnectionSet::generic_read_stored_not_found_error_handler | ( | const boost::system::error_code & | error, |
std::size_t | bytes_transferred, | ||
boost::asio::streambuf * | sBuff | ||
) | [private] |
References killSequence(), mReceivedStopRequest, processEntireResponse(), and set_generic_stored_not_found_error_handler().
Referenced by set_generic_stored_not_found_error_handler().
void Sirikata::AsyncConnectionSet::initialize | ( | Sirikata::Network::TCPSocket * | socket, |
boost::asio::ip::tcp::resolver::iterator | it | ||
) |
References connect_handler(), mPrevReadFrag, mReady, mSocket, mStrand, PROCESSING, and Sirikata::Network::IOStrand::wrap().
Referenced by Sirikata::AsyncCraqSet::initialize(), and Sirikata::AsyncCraqSet::reInitializeNode().
void Sirikata::AsyncConnectionSet::killSequence | ( | ) | [private] |
References mErrorStrand, mReady, mReadyStateChangedCallback, mReceivedStopRequest, mSocket, NEED_NEW_SOCKET, and Sirikata::Network::IOStrand::post().
Referenced by generic_read_stored_not_found_error_handler(), and write_some_handler_set().
int Sirikata::AsyncConnectionSet::numStillProcessing | ( | ) |
References allOutstandingQueries.
bool Sirikata::AsyncConnectionSet::parseStoredValue | ( | const std::string & | response, |
std::string & | dataKey | ||
) | [private] |
References Sirikata::CRAQ_DATA_KEY_SIZE, mReceivedStopRequest, Sirikata::STREAM_CRAQ_STORED_RESP, and Sirikata::STREAM_CRAQ_STORED_RESP_SIZE.
Referenced by checkStored().
bool Sirikata::AsyncConnectionSet::processEntireResponse | ( | std::string | response | ) | [private] |
void Sirikata::AsyncConnectionSet::processStoredValue | ( | std::string | dataKey | ) | [private] |
References allOutstandingQueries, Sirikata::CRAQ_DATA_KEY_SIZE, Sirikata::CraqObjectSegmentation::craqSetResult(), mOSeg, mReceivedStopRequest, mResultsStrand, Sirikata::CraqOperationResult::objID, Sirikata::Network::IOStrand::post(), Sirikata::CraqOperationResult::SET, and Sirikata::AsyncConnectionSet::IndividualQueryData::SET.
Referenced by checkStored().
void Sirikata::AsyncConnectionSet::queryTimedOutCallbackSet | ( | const boost::system::error_code & | e, |
IndividualQueryData * | iqd | ||
) | [private] |
References allOutstandingQueries, Sirikata::CRAQ_DATA_KEY_SIZE, Sirikata::AsyncConnectionSet::IndividualQueryData::currentlySearchingFor, Sirikata::AsyncCraqScheduler::erroredSetValue(), mErrorStrand, mReceivedStopRequest, mSchedulerMaster, Sirikata::CraqOperationResult::objID, Sirikata::Network::IOStrand::post(), Sirikata::CraqOperationResult::SET, and Sirikata::AsyncConnectionSet::IndividualQueryData::SET.
Referenced by set().
void Sirikata::AsyncConnectionSet::read_handler_set | ( | const boost::system::error_code & | error, |
std::size_t | bytes_transferred, | ||
boost::asio::streambuf * | sBuff | ||
) | [private] |
AsyncConnectionSet::ConnectionState Sirikata::AsyncConnectionSet::ready | ( | ) |
References mReady.
void Sirikata::AsyncConnectionSet::set | ( | const CraqDataKey & | dataToSet, |
const CraqEntry & | dataToSetTo, | ||
const bool & | track, | ||
const int & | trackNum | ||
) |
References allOutstandingQueries, Sirikata::CRAQ_DATA_SET_END_LINE, Sirikata::CRAQ_DATA_SET_PREFIX, Sirikata::CRAQ_DATA_TO_SET_SIZE, ctx, Sirikata::AsyncConnectionSet::IndividualQueryData::currentlySearchingFor, Sirikata::AsyncConnectionSet::IndividualQueryData::currentlySettingTo, Sirikata::AsyncConnectionSet::IndividualQueryData::deadline_timer, Sirikata::Time::epoch(), Sirikata::AsyncConnectionSet::IndividualQueryData::gs, Sirikata::Context::ioService, Sirikata::AsyncConnectionSet::IndividualQueryData::is_tracking, Sirikata::Time::local(), mReady, mReceivedStopRequest, mSocket, mStrand, PROCESSING, queryTimedOutCallbackSet(), Sirikata::CraqEntry::serialize(), Sirikata::AsyncConnectionSet::IndividualQueryData::SET, Sirikata::STREAM_ASYNC_SET_TIMEOUT_MILLISECONDS, Sirikata::STREAM_CRAQ_TO_SET_SUFFIX, Sirikata::STREAM_DATA_KEY_SUFFIX, Sirikata::AsyncConnectionSet::IndividualQueryData::time_admitted, Sirikata::AsyncConnectionSet::IndividualQueryData::tracking_number, Sirikata::Network::IOStrand::wrap(), and write_some_handler_set().
void Sirikata::AsyncConnectionSet::set_generic_read_error_handler | ( | ) | [private] |
void Sirikata::AsyncConnectionSet::set_generic_read_result_handler | ( | ) | [private] |
void Sirikata::AsyncConnectionSet::set_generic_stored_not_found_error_handler | ( | ) | [private] |
References generic_read_stored_not_found_error_handler(), mReceivedStopRequest, mSocket, mStrand, and Sirikata::Network::IOStrand::wrap().
Referenced by connect_handler(), and generic_read_stored_not_found_error_handler().
void Sirikata::AsyncConnectionSet::setBound | ( | const CraqObjectID & | obj_dataToGet, |
const CraqEntry & | dataToSetTo, | ||
const bool & | track, | ||
const int & | trackNum | ||
) |
References Sirikata::CraqObjectID::cdk.
Referenced by Sirikata::AsyncCraqSet::checkConnections().
void Sirikata::AsyncConnectionSet::setProcessing | ( | ) |
sets the ready state to be in the processing mode, meaning work has been posted to its strand
References mReady, and PROCESSING.
size_t Sirikata::AsyncConnectionSet::smallestIndex | ( | std::vector< size_t > | sizeVec | ) | [private] |
Referenced by checkError(), and checkStored().
void Sirikata::AsyncConnectionSet::stop | ( | ) |
References clear_all_deadline_timers(), mReceivedStopRequest, mSocket, mStrand, and Sirikata::Network::IOStrand::post().
Referenced by Sirikata::AsyncCraqSet::stop().
void Sirikata::AsyncConnectionSet::write_some_handler_set | ( | const boost::system::error_code & | error, |
std::size_t | bytes_transferred | ||
) | [private] |
References killSequence(), mReady, mReceivedStopRequest, and READY.
Referenced by set().
SpaceContext* Sirikata::AsyncConnectionSet::ctx [private] |
Referenced by set().
Referenced by connect_handler(), killSequence(), and queryTimedOutCallbackSet().
Referenced by processStoredValue().
std::string Sirikata::AsyncConnectionSet::mPrevReadFrag [private] |
Referenced by initialize(), and processEntireResponse().
volatile ConnectionState Sirikata::AsyncConnectionSet::mReady [private] |
Referenced by AsyncConnectionSet(), connect_handler(), initialize(), killSequence(), ready(), set(), setProcessing(), and write_some_handler_set().
std::tr1::function<void()> Sirikata::AsyncConnectionSet::mReadyStateChangedCallback [private] |
Referenced by connect_handler(), and killSequence().
bool Sirikata::AsyncConnectionSet::mReceivedStopRequest [private] |
Referenced by processStoredValue().
Referenced by queryTimedOutCallbackSet().
Referenced by connect_handler(), initialize(), killSequence(), set(), set_generic_stored_not_found_error_handler(), stop(), and ~AsyncConnectionSet().
Referenced by initialize(), set(), set_generic_stored_not_found_error_handler(), and stop().