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

#include <XrdClOperations.hh>

Inheritance diagram for XrdCl::PipelineHandler:
Collaboration diagram for XrdCl::PipelineHandler:

Public Member Functions

 PipelineHandler ()
 Default Constructor.
 PipelineHandler (ResponseHandler *handler)
 ~PipelineHandler ()
 Destructor.
void AddOperation (Operation< true > *operation)
void Assign (const Timeout &timeout, std::promise< XRootDStatus > prms, std::function< void(const XRootDStatus &)> final, Operation< true > *opr)
void Assign (std::function< void(const XRootDStatus &)> final)
 Assign the finalization routine.
void HandleResponse (XRootDStatus *status, AnyObject *response)
 Callback function.
void HandleResponseWithHosts (XRootDStatus *status, AnyObject *response, HostList *hostList)
 Callback function.
void PreparePipelineStart ()
 Called by a pipeline on the handler of its first operation before Run.
Public Member Functions inherited from XrdCl::ResponseHandler
virtual ~ResponseHandler ()

Friends

template<bool>
class Operation

Additional Inherited Members

Static Public Member Functions inherited from XrdCl::ResponseHandler
static ResponseHandlerWrap (std::function< void(XRootDStatus &, AnyObject &)> func)
static ResponseHandlerWrap (std::function< void(XRootDStatus *, AnyObject *)> func)

Detailed Description

Wrapper for ResponseHandler, used only internally to run next operation after previous one is finished

Definition at line 63 of file XrdClOperations.hh.

Constructor & Destructor Documentation

◆ PipelineHandler() [1/2]

XrdCl::PipelineHandler::PipelineHandler ( ResponseHandler * handler)

Constructor.

Parameters
handler: the handler of our operation

Definition at line 85 of file XrdClOperations.cc.

85 :
86 responseHandler( handler )
87 {
88 }

Referenced by PreparePipelineStart().

Here is the caller graph for this function:

◆ PipelineHandler() [2/2]

XrdCl::PipelineHandler::PipelineHandler ( )
inline

Default Constructor.

Definition at line 79 of file XrdClOperations.hh.

80 {
81 }

◆ ~PipelineHandler()

XrdCl::PipelineHandler::~PipelineHandler ( )
inline

Destructor.

Definition at line 97 of file XrdClOperations.hh.

98 {
99 }

Member Function Documentation

◆ AddOperation()

void XrdCl::PipelineHandler::AddOperation ( Operation< true > * operation)

Add new operation to the pipeline

Parameters
operation: operation to add

Definition at line 93 of file XrdClOperations.cc.

94 {
95 if( nextOperation )
96 {
97 nextOperation->AddOperation( operation );
98 }
99 else
100 {
101 nextOperation.reset( operation );
102 }
103 }

References Operation.

Here is the call graph for this function:

◆ Assign() [1/2]

void XrdCl::PipelineHandler::Assign ( const Timeout & timeout,
std::promise< XRootDStatus > prms,
std::function< void(const XRootDStatus &)> final,
Operation< true > * opr )

Set workflow to this and all next handlers. In the last handler it is used to finish workflow execution

Parameters
prms: a promis that the pipeline will have a result
final: a callable that should be called at the end of pipeline

Definition at line 189 of file XrdClOperations.cc.

193 {
194 timeout = t;
195 prms = std::move( p );
196 if( !final ) final = std::move( f );
197 else if( f )
198 {
199 auto f1 = std::move( final );
200 final = [f1, f]( const XRootDStatus &st ){ f1( st ); f( st ); };
201 }
202 currentOperation.reset( opr );
203 }

References Operation.

Referenced by PreparePipelineStart().

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

◆ Assign() [2/2]

void XrdCl::PipelineHandler::Assign ( std::function< void(const XRootDStatus &)> final)

Assign the finalization routine.

Definition at line 208 of file XrdClOperations.cc.

209 {
210 final = std::move( f );
211 }

◆ HandleResponse()

void XrdCl::PipelineHandler::HandleResponse ( XRootDStatus * status,
AnyObject * response )
virtual

Callback function.

Reimplemented from XrdCl::ResponseHandler.

Definition at line 180 of file XrdClOperations.cc.

182 {
183 HandleResponseImpl( status, response );
184 }

◆ HandleResponseWithHosts()

void XrdCl::PipelineHandler::HandleResponseWithHosts ( XRootDStatus * status,
AnyObject * response,
HostList * hostList )
virtual

Callback function.

Reimplemented from XrdCl::ResponseHandler.

Definition at line 171 of file XrdClOperations.cc.

173 {
174 HandleResponseImpl( status, response, hostList );
175 }

◆ PreparePipelineStart()

void XrdCl::PipelineHandler::PreparePipelineStart ( )

Called by a pipeline on the handler of its first operation before Run.

Definition at line 216 of file XrdClOperations.cc.

217 {
218 // Move any final-function from the handler of the last operaiton to the
219 // first. It will be moved along the pipeline of handlers while the
220 // pipeline is run.
221
222 if( final || !nextOperation ) return;
223 PipelineHandler *last = nextOperation->handler.get();
224 while( last )
225 {
226 Operation<true> *nextop = last->nextOperation.get();
227 if( !nextop ) break;
228 last = nextop->handler.get();
229 }
230 if( last )
231 {
232 // swap-then-move rather than only move as we need to guarantee that
233 // last->final is left without target.
234 std::function<void(const XRootDStatus&)> f;
235 f.swap( last->final );
236 Assign( std::move( f ) );
237 }
238 }
void Assign(const Timeout &timeout, std::promise< XRootDStatus > prms, std::function< void(const XRootDStatus &)> final, Operation< true > *opr)
PipelineHandler(ResponseHandler *handler)

References PipelineHandler(), Assign(), XrdCl::Operation< HasHndl >::handler, and Operation.

Here is the call graph for this function:

◆ Operation

template<bool>
friend class Operation
friend

Definition at line 65 of file XrdClOperations.hh.

References Operation.

Referenced by AddOperation(), Assign(), Operation, and PreparePipelineStart().


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