1 #ifndef Utilities_XrdAdaptor_XrdRequestManager_h
2 #define Utilities_XrdAdaptor_XrdRequestManager_h
7 #include <condition_variable>
11 #include <boost/utility.hpp>
15 #include "XrdCl/XrdClFileSystem.hh"
24 namespace XrdAdaptor {
59 std::future<IOSize>
handle(std::shared_ptr<std::vector<IOPosBuffer> > iolist);
67 std::future<IOSize>
handle(std::shared_ptr<XrdAdaptor::ClientRequest> c_ptr);
110 static std::shared_ptr<RequestManager>
114 instance->initialize(instance);
128 void initialize(std::weak_ptr<RequestManager> selfref);
133 virtual void handleOpen(XrdCl::XRootDStatus &
status, std::shared_ptr<Source>);
138 void splitClientRequest(
const std::vector<IOPosBuffer> &iolist, std::vector<IOPosBuffer> &req1, std::vector<IOPosBuffer> &req2);
211 class OpenHandler : boost::noncopyable,
public XrdCl::ResponseHandler {
215 static std::shared_ptr<OpenHandler>
getInstance(std::weak_ptr<RequestManager> manager)
218 std::shared_ptr<OpenHandler>
instance(instance_ptr);
235 std::shared_future<std::shared_ptr<Source> >
open();
244 OpenHandler(std::weak_ptr<RequestManager> manager);
std::shared_future< std::shared_ptr< Source > > open()
~RequestManager()=default
const std::string & getFilename() const
static PFTauRenderPlugin instance
RequestManager(const std::string &filename, XrdCl::OpenFlags::Flags flags, XrdCl::Access::Mode perms)
std::uniform_real_distribution< float > m_distribution
XrootdException(XrdCl::Status &xrootd_status, edm::Exception::Code code)
std::vector< Variable::Flags > flags
void updateSiteInfo(std::string orig_site="")
std::set< std::string > m_disabledSourceStrings
OpenHandler(std::weak_ptr< RequestManager > manager)
std::shared_ptr< OpenHandler > m_self
virtual void handleOpen(XrdCl::XRootDStatus &status, std::shared_ptr< Source >)
static std::shared_ptr< RequestManager > getInstance(const std::string &filename, XrdCl::OpenFlags::Flags flags, XrdCl::Access::Mode perms)
std::weak_ptr< OpenHandler > m_self_weak
bool compareSources(const timespec &now, unsigned a, unsigned b)
static const unsigned int XRD_DEFAULT_TIMEOUT
std::shared_future< std::shared_ptr< Source > > m_shared_future
void addConnections(cms::Exception &)
std::weak_ptr< RequestManager > m_manager
std::set< std::shared_ptr< Source > > m_disabledSources
std::vector< std::shared_ptr< Source > > m_inactiveSources
timespec m_nextActiveSourceCheck
std::set< std::string > m_disabledExcludeStrings
std::shared_ptr< XrdCl::File > getActiveFile()
std::string current_source()
std::shared_ptr< OpenHandler > m_open_handler
void requestFailure(std::shared_ptr< XrdAdaptor::ClientRequest > c_ptr, XrdCl::Status &c_status)
virtual void HandleResponseWithHosts(XrdCl::XRootDStatus *status, XrdCl::AnyObject *response, XrdCl::HostList *hostList) override
std::string prepareOpaqueString()
XrdCl::OpenFlags::Flags m_flags
std::recursive_mutex m_mutex
virtual ~XrootdException()
static std::shared_ptr< OpenHandler > getInstance(std::weak_ptr< RequestManager > manager)
void getActiveSourceNames(std::vector< std::string > &sources)
void checkSources(timespec &now, IOSize requestSize)
std::string m_activeSites
std::vector< std::shared_ptr< Source > > m_activeSources
XrdCl::Access::Mode m_perms
void checkSourcesImpl(timespec &now, IOSize requestSize)
std::atomic< unsigned > m_excluded_active_count
std::shared_ptr< Source > pickSingleSource()
void getDisabledSourceNames(std::vector< std::string > &sources)
void getPrettyActiveSourceNames(std::vector< std::string > &sources)
std::unique_ptr< XrdCl::File > m_file
void splitClientRequest(const std::vector< IOPosBuffer > &iolist, std::vector< IOPosBuffer > &req1, std::vector< IOPosBuffer > &req2)
std::future< IOSize > handle(void *into, IOSize size, IOOffset off)
std::promise< std::shared_ptr< Source > > m_promise
tuple size
Write out results.
std::recursive_mutex m_source_mutex
bool m_nextInitialSourceToggle
timespec m_lastSourceCheck
void broadcastRequest(const ClientRequest &, bool active)
void initialize(std::weak_ptr< RequestManager > selfref)