XRootD
Loading...
Searching...
No Matches
XrdCl::RedirectorRegistry Class Reference

Singleton access to URL to virtual redirector mapping. More...

#include <XrdClRedirectorRegistry.hh>

Collaboration diagram for XrdCl::RedirectorRegistry:

Public Member Functions

 ~RedirectorRegistry ()
 Destructor.
VirtualRedirectorGet (const URL &url) const
 Get a virtual redirector associated with the given URL.
XRootDStatus Register (const URL &url)
 Creates a new virtual redirector and registers it (async).
XRootDStatus RegisterAndWait (const URL &url)
 Creates a new virtual redirector and registers it (sync).
void Release (const URL &url)
 Release the virtual redirector associated with the given URL.

Static Public Member Functions

static RedirectorRegistry & Instance ()
 Returns reference to the single instance.

Detailed Description

Singleton access to URL to virtual redirector mapping.

Definition at line 118 of file XrdClRedirectorRegistry.hh.

Constructor & Destructor Documentation

◆ ~RedirectorRegistry()

XrdCl::RedirectorRegistry::~RedirectorRegistry ( )

Destructor.

Definition at line 35 of file XrdClRedirectorRegistry.cc.

36{
37 RedirectorMap::iterator itr;
38 for( itr = pRegistry.begin(); itr != pRegistry.end(); ++itr )
39 delete itr->second.first;
40}

Member Function Documentation

◆ Get()

VirtualRedirector * XrdCl::RedirectorRegistry::Get ( const URL & url) const

Get a virtual redirector associated with the given URL.

Definition at line 116 of file XrdClRedirectorRegistry.cc.

117{
118 URL url = ConvertLocalfile( u );
119
120 XrdSysMutexHelper scopedLock( pMutex );
121 // get the key and return the value if it is in the registry
122 // offset 24 is where the path has been stored
123 const std::string key = url.GetLocation();
124 RedirectorMap::const_iterator itr = pRegistry.find( key );
125 if( itr != pRegistry.end() )
126 return itr->second.first;
127 // otherwise return null
128 return 0;
129}

References XrdCl::URL::GetLocation().

Referenced by XrdCl::Utils::InferChecksumType(), XrdCl::CopyProcess::Prepare(), and XrdCl::PostMaster::Redirect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Instance()

RedirectorRegistry & XrdCl::RedirectorRegistry::Instance ( )
static

Returns reference to the single instance.

Definition at line 29 of file XrdClRedirectorRegistry.cc.

30{
31 static RedirectorRegistry redirector;
32 return redirector;
33}

Referenced by XrdCl::FileStateHandler::~FileStateHandler(), XrdCl::Utils::InferChecksumType(), XrdCl::CopyProcess::Prepare(), XrdCl::PostMaster::Redirect(), XrdCl::MessageUtils::RedirectMessage(), and XrdCl::ThirdPartyCopyJob::Run().

Here is the caller graph for this function:

◆ Register()

XRootDStatus XrdCl::RedirectorRegistry::Register ( const URL & url)

Creates a new virtual redirector and registers it (async).

Definition at line 103 of file XrdClRedirectorRegistry.cc.

104{
105 return RegisterImpl( url, 0 );
106}

Referenced by XrdCl::MessageUtils::RedirectMessage().

Here is the caller graph for this function:

◆ RegisterAndWait()

XRootDStatus XrdCl::RedirectorRegistry::RegisterAndWait ( const URL & url)

Creates a new virtual redirector and registers it (sync).

Definition at line 108 of file XrdClRedirectorRegistry.cc.

109{
110 SyncResponseHandler handler;
111 Status st = RegisterImpl( url, &handler );
112 if( !st.IsOK() ) return st;
113 return MessageUtils::WaitForStatus( &handler );
114}
static XRootDStatus WaitForStatus(SyncResponseHandler *handler)
Wait and return the status of the query.

References XrdCl::Status::IsOK(), and XrdCl::MessageUtils::WaitForStatus().

Referenced by XrdCl::CopyProcess::Prepare().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Release()

void XrdCl::RedirectorRegistry::Release ( const URL & url)

Release the virtual redirector associated with the given URL.

Definition at line 134 of file XrdClRedirectorRegistry.cc.

135{
136 URL url = ConvertLocalfile( u );
137
138 XrdSysMutexHelper scopedLock( pMutex );
139 // get the key and return the value if it is in the registry
140 // offset 24 is where the path has been stored
141 const std::string key = url.GetLocation();
142 RedirectorMap::iterator itr = pRegistry.find( key );
143 if( itr == pRegistry.end() ) return;
144 // decrement user counter
145 --itr->second.second;
146 // if nobody is using it delete the object
147 // and remove it from the registry
148 if( !itr->second.second )
149 {
150 delete itr->second.first;
151 pRegistry.erase( itr );
152 }
153}

References XrdCl::URL::GetLocation().

Referenced by XrdCl::FileStateHandler::~FileStateHandler().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: