#include <XrdRequestManager.h>
|
void | broadcastRequest (const ClientRequest &, bool active) |
|
void | checkSources (timespec &now, IOSize requestSize, std::vector< std::shared_ptr< Source >> &activeSources, std::vector< std::shared_ptr< Source >> &inactiveSources) |
|
void | checkSourcesImpl (timespec &now, IOSize requestSize, std::vector< std::shared_ptr< Source >> &activeSources, std::vector< std::shared_ptr< Source >> &inactiveSources) |
|
bool | compareSources (const timespec &now, unsigned a, unsigned b, std::vector< std::shared_ptr< Source >> &activeSources, std::vector< std::shared_ptr< Source >> &inactiveSources) const |
|
virtual void | handleOpen (XrdCl::XRootDStatus &status, std::shared_ptr< Source >) |
|
void | initialize (std::weak_ptr< RequestManager > selfref) |
|
std::shared_ptr< Source > | pickSingleSource () |
|
std::string | prepareOpaqueString () const |
|
void | queueUpdateCurrentServer (const std::string &) |
|
void | reportSiteChange (std::vector< std::shared_ptr< Source > > const &iOld, std::vector< std::shared_ptr< Source > > const &iNew, std::string orig_site=std::string{}) const |
|
| RequestManager (const std::string &filename, XrdCl::OpenFlags::Flags flags, XrdCl::Access::Mode perms) |
|
void | splitClientRequest (const std::vector< IOPosBuffer > &iolist, std::vector< IOPosBuffer > &req1, std::vector< IOPosBuffer > &req2, std::vector< std::shared_ptr< Source >> const &activeSources) const |
|
void | updateCurrentServer () |
|
Definition at line 53 of file XrdRequestManager.h.
XrdAdaptor::RequestManager::~RequestManager |
( |
| ) |
|
|
default |
RequestManager::RequestManager |
( |
const std::string & |
filename, |
|
|
XrdCl::OpenFlags::Flags |
flags, |
|
|
XrdCl::Access::Mode |
perms |
|
) |
| |
|
private |
Add the list of active connections to the exception extra info.
Definition at line 510 of file XrdRequestManager.cc.
void XrdAdaptor::RequestManager::broadcastRequest |
( |
const ClientRequest & |
, |
|
|
bool |
active |
|
) |
| |
|
private |
Given a request, broadcast it to all sources. If active is true, broadcast is made to all active sources. Otherwise, broadcast is made to the inactive sources.
void RequestManager::checkSources |
( |
timespec & |
now, |
|
|
IOSize |
requestSize, |
|
|
std::vector< std::shared_ptr< Source >> & |
activeSources, |
|
|
std::vector< std::shared_ptr< Source >> & |
inactiveSources |
|
) |
| |
|
private |
Check our set of active sources. If necessary, this will kick off a search for a new source. The source check is somewhat expensive so it is only done once every second.
Definition at line 324 of file XrdRequestManager.cc.
void RequestManager::checkSourcesImpl |
( |
timespec & |
now, |
|
|
IOSize |
requestSize, |
|
|
std::vector< std::shared_ptr< Source >> & |
activeSources, |
|
|
std::vector< std::shared_ptr< Source >> & |
inactiveSources |
|
) |
| |
|
private |
bool RequestManager::compareSources |
( |
const timespec & |
now, |
|
|
unsigned |
a, |
|
|
unsigned |
b, |
|
|
std::vector< std::shared_ptr< Source >> & |
activeSources, |
|
|
std::vector< std::shared_ptr< Source >> & |
inactiveSources |
|
) |
| const |
|
private |
Helper function for checkSources; compares the quality of source A versus source B; if source A is significantly worse, remove it from the list of active sources.
NOTE: assumes two sources are active and the caller must already hold m_source_mutex
Definition at line 347 of file XrdRequestManager.cc.
std::shared_ptr< XrdCl::File > RequestManager::getActiveFile |
( |
void |
| ) |
const |
Return a pointer to an active file. Useful for metadata operations.
Definition at line 463 of file XrdRequestManager.cc.
void RequestManager::getActiveSourceNames |
( |
std::vector< std::string > & |
sources | ) |
const |
Retrieve the names of the active sources (primarily meant to enable meaningful log messages).
Definition at line 481 of file XrdRequestManager.cc.
void RequestManager::getDisabledSourceNames |
( |
std::vector< std::string > & |
sources | ) |
const |
Retrieve the names of the disabled sources (primarily meant to enable meaningful log messages).
Definition at line 501 of file XrdRequestManager.cc.
const std::string& XrdAdaptor::RequestManager::getFilename |
( |
| ) |
const |
|
inline |
static std::shared_ptr<RequestManager> XrdAdaptor::RequestManager::getInstance |
( |
const std::string & |
filename, |
|
|
XrdCl::OpenFlags::Flags |
flags, |
|
|
XrdCl::Access::Mode |
perms |
|
) |
| |
|
inlinestatic |
Some of the callback handlers need a weak_ptr reference to the RequestManager. This allows the callback handler to know when it is OK to invoke RequestManager methods.
Hence, all instances need to be created through this factory function.
Definition at line 121 of file XrdRequestManager.h.
void RequestManager::getPrettyActiveSourceNames |
( |
std::vector< std::string > & |
sources | ) |
const |
std::future< IOSize > XrdAdaptor::RequestManager::handle |
( |
std::shared_ptr< std::vector< IOPosBuffer > > |
iolist | ) |
|
Handle a client request. NOTE: The shared_ptr interface is required. Depending on the state of the manager, it may decide to issue multiple requests and return the first successful. In that case, some references to the client request may still be outstanding when this function returns.
Definition at line 565 of file XrdRequestManager.cc.
void XrdAdaptor::RequestManager::handleOpen |
( |
XrdCl::XRootDStatus & |
status, |
|
|
std::shared_ptr< Source > |
source |
|
) |
| |
|
privatevirtual |
void RequestManager::initialize |
( |
std::weak_ptr< RequestManager > |
selfref | ) |
|
|
private |
Some of the callback handlers (particularly, file-open one) will want to call back into the RequestManager. However, the XrdFile may have already thrown away the reference. Hence, we need a weak_ptr to the original object before we can initialize. This way, callback knows to not reference the RequestManager.
Definition at line 129 of file XrdRequestManager.cc.
std::shared_ptr< Source > RequestManager::pickSingleSource |
( |
| ) |
|
|
private |
std::string RequestManager::prepareOpaqueString |
( |
| ) |
const |
|
private |
Prepare an opaque string appropriate for asking a redirector to open the current file but avoiding servers which we already have connections to.
Definition at line 594 of file XrdRequestManager.cc.
void RequestManager::queueUpdateCurrentServer |
( |
const std::string & |
id | ) |
|
|
private |
void RequestManager::reportSiteChange |
( |
std::vector< std::shared_ptr< Source > > const & |
iOld, |
|
|
std::vector< std::shared_ptr< Source > > const & |
iNew, |
|
|
std::string |
orig_site = std::string{} |
|
) |
| const |
|
private |
Anytime we potentially switch sources, update the internal site source list; alert the user if necessary.
Definition at line 303 of file XrdRequestManager.cc.
void XrdAdaptor::RequestManager::splitClientRequest |
( |
const std::vector< IOPosBuffer > & |
iolist, |
|
|
std::vector< IOPosBuffer > & |
req1, |
|
|
std::vector< IOPosBuffer > & |
req2, |
|
|
std::vector< std::shared_ptr< Source >> const & |
activeSources |
|
) |
| const |
|
private |
void RequestManager::updateCurrentServer |
( |
| ) |
|
|
inlineprivate |
Update the StatisticsSenderService, if necessary, with the current server.
Update the StatisticsSenderService with the current server info.
As this accesses the edm::Service infrastructure, this MUST be called from an edm-managed thread. It CANNOT be called from an Xrootd-managed thread.
Definition at line 259 of file XrdRequestManager.cc.
std::vector<std::shared_ptr<Source> > XrdAdaptor::RequestManager::m_activeSources |
|
private |
Note these member variables can only be accessed when the source mutex is held.
Definition at line 212 of file XrdRequestManager.h.
tbb::concurrent_unordered_set<std::string> XrdAdaptor::RequestManager::m_disabledExcludeStrings |
|
private |
tbb::concurrent_unordered_set<std::shared_ptr<Source>, SourceHash> XrdAdaptor::RequestManager::m_disabledSources |
|
private |
tbb::concurrent_unordered_set<std::string> XrdAdaptor::RequestManager::m_disabledSourceStrings |
|
private |
std::uniform_real_distribution<float> XrdAdaptor::RequestManager::m_distribution |
|
private |
std::atomic<unsigned> XrdAdaptor::RequestManager::m_excluded_active_count |
|
private |
XrdCl::OpenFlags::Flags XrdAdaptor::RequestManager::m_flags |
|
private |
std::mt19937 XrdAdaptor::RequestManager::m_generator |
|
private |
std::vector<std::shared_ptr<Source> > XrdAdaptor::RequestManager::m_inactiveSources |
|
private |
timespec XrdAdaptor::RequestManager::m_lastSourceCheck |
|
private |
const std::string XrdAdaptor::RequestManager::m_name |
|
private |
timespec XrdAdaptor::RequestManager::m_nextActiveSourceCheck |
|
private |
bool XrdAdaptor::RequestManager::m_nextInitialSourceToggle |
|
private |
std::shared_ptr<OpenHandler> XrdAdaptor::RequestManager::m_open_handler |
|
private |
XrdCl::Access::Mode XrdAdaptor::RequestManager::m_perms |
|
private |
std::atomic<std::string*> XrdAdaptor::RequestManager::m_serverToAdvertise |
|
private |
std::recursive_mutex XrdAdaptor::RequestManager::m_source_mutex |
|
mutableprivate |
int XrdAdaptor::RequestManager::m_timeout |
|
private |
bool XrdAdaptor::RequestManager::searchMode |
|
private |
const unsigned int XrdAdaptor::RequestManager::XRD_DEFAULT_TIMEOUT = 3*60 |
|
static |