Go to the documentation of this file.
26 #ifndef __XRD_CL_PARALLELOPERATION_HH__
27 #define __XRD_CL_PARALLELOPERATION_HH__
71 template<
bool HasHndl>
96 template<
class Container>
99 static_assert( !HasHndl,
"Constructor is available only operation without handler");
102 auto begin = std::make_move_iterator( container.begin() );
103 auto end = std::make_move_iterator( container.end() );
104 std::copy( begin, end, std::back_inserter(
pipelines ) );
113 std::ostringstream oss;
115 for(
size_t i = 0; i <
pipelines.size(); i++ )
136 return std::move( *
this );
148 return std::move( *
this );
160 return std::move( *
this );
173 return std::move( *
this );
188 if( status.
IsOK() )
return false;
209 size_t nb =
cnt.fetch_sub( 1 );
211 if( status.
IsOK() )
return true;
213 if( nb == 1 )
return true;
237 size_t nb =
cnt.fetch_sub( 1 );
273 size_t nb =
cnt.fetch_sub( 1 );
275 if( status.
IsOK() )
return false;
320 if(
policy->Examine( st ) )
360 std::shared_ptr<Ctx> ctx =
361 std::make_shared<Ctx>( this->
handler.release(),
policy.release() );
365 for(
size_t i = 0; i <
pipelines.size(); ++i )
374 catch(
const std::exception& ex )
389 template<
class Container>
407 template<
typename ... Others>
408 inline void PipesToVec( std::vector<Pipeline> &v, Operation<false> &operation,
411 template<
typename ... Others>
412 inline void PipesToVec( std::vector<Pipeline> &v, Operation<true> &operation,
415 template<
typename ... Others>
416 inline void PipesToVec( std::vector<Pipeline> &v, Pipeline &pipeline,
422 template<
typename ... Others>
426 v.emplace_back( operation );
430 template<
typename ... Others>
434 v.emplace_back( operation );
438 template<
typename ... Others>
442 v.emplace_back( std::move( pipeline ) );
452 template<
typename ... Operations>
455 constexpr
size_t size =
sizeof...( operations );
456 std::vector<Pipeline> v;
463 #endif // __XRD_CL_OPERATIONS_HH__
Definition: XrdClOperationHandlers.hh:648
std::string ToString()
Definition: XrdClParallelOperation.hh:111
Definition: XrdClParallelOperation.hh:229
AtLeastPolicy(size_t size, size_t threshold)
Definition: XrdClParallelOperation.hh:266
std::atomic< size_t > succeeded
Definition: XrdClParallelOperation.hh:253
const XRootDStatus & GetError() const
Definition: XrdClOperationHandlers.hh:399
void Handle(const XRootDStatus &st)
Definition: XrdClParallelOperation.hh:330
std::vector< Pipeline > pipelines
Definition: XrdClParallelOperation.hh:382
virtual bool Examine(const XrdCl::XRootDStatus &status)=0
ParallelOperation< HasHndl > Any()
Definition: XrdClParallelOperation.hh:145
std::atomic< size_t > cnt
Definition: XrdClParallelOperation.hh:219
const size_t threshold
Definition: XrdClParallelOperation.hh:283
Definition: XrdClOperations.hh:57
std::unique_ptr< PolicyExecutor > policy
Policy defining when the user handler should be called.
Definition: XrdClParallelOperation.hh:345
bool Examine(const XrdCl::XRootDStatus &status)
Definition: XrdClParallelOperation.hh:270
AnyPolicy(size_t size)
Definition: XrdClParallelOperation.hh:202
std::unique_ptr< PipelineHandler > handler
Operation handler.
Definition: XrdClOperations.hh:288
Definition: XrdClParallelOperation.hh:201
Pipeline exception, wrapps an XRootDStatus.
Definition: XrdClOperationHandlers.hh:360
void PipesToVec(std::vector< Pipeline > &)
Helper function for converting parameter pack into a vector.
Definition: XrdClParallelOperation.hh:398
Definition: XrdClOperations.hh:476
const size_t threshold
Definition: XrdClParallelOperation.hh:254
Definition: XrdClParallelOperation.hh:73
Definition: XrdClParallelOperation.hh:293
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback function.
XRootDStatus RunImpl()
Definition: XrdClParallelOperation.hh:355
Request status.
Definition: XrdClXRootDResponses.hh:215
std::atomic< PipelineHandler * > handler
PipelineHandler of the ParallelOperation.
Definition: XrdClParallelOperation.hh:340
std::unique_ptr< PolicyExecutor > policy
Definition: XrdClParallelOperation.hh:383
ParallelOperation< HasHndl > All()
Definition: XrdClParallelOperation.hh:133
Ctx(PipelineHandler *handler, PolicyExecutor *policy)
Definition: XrdClParallelOperation.hh:299
Definition: XrdClParallelOperation.hh:185
ParallelOperation< HasHndl > Some(size_t threshold)
Definition: XrdClParallelOperation.hh:157
Definition: XrdClOperations.hh:304
Definition: XrdClParallelOperation.hh:56
bool IsOK() const
We're fine.
Definition: XrdClStatus.hh:120
Definition: XrdClParallelOperation.hh:265
Definition: XrdClAnyObject.hh:26
Definition: XrdClOperations.hh:166
std::atomic< size_t > cnt
Definition: XrdClParallelOperation.hh:252
virtual ~PolicyExecutor()
Definition: XrdClParallelOperation.hh:57
bool Examine(const XrdCl::XRootDStatus &status)
Definition: XrdClParallelOperation.hh:186
bool Examine(const XrdCl::XRootDStatus &status)
Definition: XrdClParallelOperation.hh:234
std::atomic< size_t > cnt
Definition: XrdClParallelOperation.hh:282
const uint16_t stError
An error occurred that could potentially be retried.
Definition: XrdClStatus.hh:32
ParallelOperation(Container &&container)
Definition: XrdClParallelOperation.hh:97
ParallelOperation< HasHndl > AtLeast(size_t threshold)
Definition: XrdClParallelOperation.hh:170
ParallelOperation(ParallelOperation< from > &&obj)
Constructor: copy-move a ParallelOperation in different state.
Definition: XrdClParallelOperation.hh:82
void Examine(const XRootDStatus &st)
Definition: XrdClParallelOperation.hh:318
ParallelOperation< false > Parallel(Container &container)
Factory function for creating parallel operation from a vector.
Definition: XrdClParallelOperation.hh:390
bool Examine(const XrdCl::XRootDStatus &status)
Definition: XrdClParallelOperation.hh:206
SomePolicy(size_t size, size_t threshold)
Definition: XrdClParallelOperation.hh:230
~Ctx()
Destructor.
Definition: XrdClParallelOperation.hh:307