XRootD
Loading...
Searching...
No Matches
XrdCl::PostMasterImpl Struct Reference
Collaboration diagram for XrdCl::PostMasterImpl:

Public Types

typedef std::map< std::string, std::shared_ptr< Channel > > ChannelMap

Public Member Functions

 PostMasterImpl ()
 ~PostMasterImpl ()
void addFinalize (Channel *ch)
 Used to maintain a non-owning set of live Channels. Used by Finalize.
std::shared_ptr< ChannelGetChannel (const URL &url)
 Get a channel for url, creating one if needed.
void removeFinalize (Channel *ch)
 Used to maintain a non-owning set of live Channels. Used by Finalize.

Public Attributes

ChannelMap pChannelMap
XrdSysMutex pChannelMapMutex
std::unordered_set< Channel * > pFinalizeSet
XrdSysMutex pFinalizeSetMutex
bool pInitialized
JobManagerpJobManager
XrdSysMutex pMtx
std::function< void(const URL &, const XRootDStatus &)> pOnConnErrCB
std::unique_ptr< JobpOnConnJob
PollerpPoller
bool pRunning
TaskManagerpTaskManager

Detailed Description

Definition at line 60 of file XrdClPostMaster.cc.

Member Typedef Documentation

◆ ChannelMap

typedef std::map<std::string, std::shared_ptr<Channel> > XrdCl::PostMasterImpl::ChannelMap

Definition at line 102 of file XrdClPostMaster.cc.

Constructor & Destructor Documentation

◆ PostMasterImpl()

XrdCl::PostMasterImpl::PostMasterImpl ( )
inline

Definition at line 62 of file XrdClPostMaster.cc.

62 : pPoller( 0 ), pInitialized( false ), pRunning( false )
63 {
64 Env *env = DefaultEnv::GetEnv();
65 int workerThreads = DefaultWorkerThreads;
66 env->GetInt( "WorkerThreads", workerThreads );
67
68 pTaskManager = new TaskManager();
69 pJobManager = new JobManager(workerThreads);
70 }
static Env * GetEnv()
Get default client environment.
const int DefaultWorkerThreads

References XrdCl::DefaultWorkerThreads, XrdCl::DefaultEnv::GetEnv(), XrdCl::Env::GetInt(), pInitialized, pJobManager, pPoller, pRunning, and pTaskManager.

Here is the call graph for this function:

◆ ~PostMasterImpl()

XrdCl::PostMasterImpl::~PostMasterImpl ( )
inline

Definition at line 72 of file XrdClPostMaster.cc.

73 {
74 delete pPoller;
75 delete pTaskManager;
76 delete pJobManager;
77 }

References pJobManager, pPoller, and pTaskManager.

Member Function Documentation

◆ addFinalize()

void XrdCl::PostMasterImpl::addFinalize ( Channel * ch)
inline

Used to maintain a non-owning set of live Channels. Used by Finalize.

Definition at line 82 of file XrdClPostMaster.cc.

83 {
84 XrdSysMutexHelper lck( pFinalizeSetMutex );
85 pFinalizeSet.insert( ch );
86 }
std::unordered_set< Channel * > pFinalizeSet

References pFinalizeSet, and pFinalizeSetMutex.

Referenced by GetChannel().

Here is the caller graph for this function:

◆ GetChannel()

std::shared_ptr< Channel > XrdCl::PostMasterImpl::GetChannel ( const URL & url)

Get a channel for url, creating one if needed.

Definition at line 566 of file XrdClPostMaster.cc.

567 {
568 XrdSysMutexHelper scopedLock( pChannelMapMutex );
569 std::shared_ptr<Channel> channel;
570 PostMasterImpl::ChannelMap::iterator it = pChannelMap.find( url.GetChannelId() );
571
572 if( it == pChannelMap.end() )
573 {
574 TransportManager *trManager = DefaultEnv::GetTransportManager();
575 TransportHandler *trHandler = trManager->GetHandler( url.GetProtocol() );
576
577 if( !trHandler )
578 {
579 Log *log = DefaultEnv::GetLog();
580 log->Error( PostMasterMsg, "Unable to get transport handler for %s "
581 "protocol", url.GetProtocol().c_str() );
582 return 0;
583 }
584
585 std::shared_ptr<Channel> newchan(new Channel{ url, pPoller,
586 trHandler, pTaskManager, pJobManager },
587 [this](Channel *ch) { this->removeFinalize( ch ); delete ch; });
588 addFinalize( newchan.get() );
589 channel = newchan;
590 channel->SetSelf( channel );
591
592 pChannelMap[url.GetChannelId()] = channel;
593 }
594 else
595 channel = it->second;
596 return channel;
597 }
static TransportManager * GetTransportManager()
Get transport manager.
static Log * GetLog()
Get default log.
const uint64_t PostMasterMsg
XrdSysError Log
Definition XrdConfig.cc:113
void addFinalize(Channel *ch)
Used to maintain a non-owning set of live Channels. Used by Finalize.
void removeFinalize(Channel *ch)
Used to maintain a non-owning set of live Channels. Used by Finalize.

References addFinalize(), XrdCl::Log::Error(), XrdCl::URL::GetChannelId(), XrdCl::TransportManager::GetHandler(), XrdCl::DefaultEnv::GetLog(), XrdCl::URL::GetProtocol(), XrdCl::DefaultEnv::GetTransportManager(), pChannelMap, pChannelMapMutex, pJobManager, XrdCl::PostMasterMsg, pPoller, pTaskManager, and removeFinalize().

Here is the call graph for this function:

◆ removeFinalize()

void XrdCl::PostMasterImpl::removeFinalize ( Channel * ch)
inline

Used to maintain a non-owning set of live Channels. Used by Finalize.

Definition at line 96 of file XrdClPostMaster.cc.

97 {
98 XrdSysMutexHelper lck( pFinalizeSetMutex );
99 pFinalizeSet.erase( ch );
100 }

References pFinalizeSet, and pFinalizeSetMutex.

Referenced by GetChannel().

Here is the caller graph for this function:

Member Data Documentation

◆ pChannelMap

ChannelMap XrdCl::PostMasterImpl::pChannelMap

Definition at line 106 of file XrdClPostMaster.cc.

Referenced by GetChannel().

◆ pChannelMapMutex

XrdSysMutex XrdCl::PostMasterImpl::pChannelMapMutex

Definition at line 110 of file XrdClPostMaster.cc.

Referenced by GetChannel().

◆ pFinalizeSet

std::unordered_set<Channel*> XrdCl::PostMasterImpl::pFinalizeSet

Definition at line 107 of file XrdClPostMaster.cc.

Referenced by addFinalize(), and removeFinalize().

◆ pFinalizeSetMutex

XrdSysMutex XrdCl::PostMasterImpl::pFinalizeSetMutex

Definition at line 113 of file XrdClPostMaster.cc.

Referenced by addFinalize(), and removeFinalize().

◆ pInitialized

bool XrdCl::PostMasterImpl::pInitialized

Definition at line 115 of file XrdClPostMaster.cc.

Referenced by PostMasterImpl().

◆ pJobManager

JobManager* XrdCl::PostMasterImpl::pJobManager

Definition at line 117 of file XrdClPostMaster.cc.

Referenced by PostMasterImpl(), ~PostMasterImpl(), and GetChannel().

◆ pMtx

XrdSysMutex XrdCl::PostMasterImpl::pMtx

Definition at line 119 of file XrdClPostMaster.cc.

◆ pOnConnErrCB

std::function<void( const URL&, const XRootDStatus& )> XrdCl::PostMasterImpl::pOnConnErrCB

Definition at line 121 of file XrdClPostMaster.cc.

◆ pOnConnJob

std::unique_ptr<Job> XrdCl::PostMasterImpl::pOnConnJob

Definition at line 120 of file XrdClPostMaster.cc.

◆ pPoller

Poller* XrdCl::PostMasterImpl::pPoller

Definition at line 104 of file XrdClPostMaster.cc.

Referenced by PostMasterImpl(), ~PostMasterImpl(), and GetChannel().

◆ pRunning

bool XrdCl::PostMasterImpl::pRunning

Definition at line 116 of file XrdClPostMaster.cc.

Referenced by PostMasterImpl().

◆ pTaskManager

TaskManager* XrdCl::PostMasterImpl::pTaskManager

Definition at line 105 of file XrdClPostMaster.cc.

Referenced by PostMasterImpl(), ~PostMasterImpl(), and GetChannel().


The documentation for this struct was generated from the following file: