XRootD
XrdCl::ParallelOperation< HasHndl > Class Template Reference

#include <XrdClParallelOperation.hh>

+ Inheritance diagram for XrdCl::ParallelOperation< HasHndl >:
+ Collaboration diagram for XrdCl::ParallelOperation< HasHndl >:

Public Member Functions

template<class Container >
 ParallelOperation (Container &&container)
 
template<bool from>
 ParallelOperation (ParallelOperation< from > &&obj)
 Constructor: copy-move a ParallelOperation in different state. More...
 
 ~ParallelOperation ()
 
ParallelOperation< HasHndl > All ()
 
ParallelOperation< HasHndl > Any ()
 
ParallelOperation< HasHndl > AtLeast (size_t threshold)
 
ParallelOperation< HasHndl > Some (size_t threshold)
 
std::string ToString ()
 
- Public Member Functions inherited from XrdCl::ConcreteOperation< ParallelOperation, HasHndl, Resp< void > >
 ConcreteOperation (Args &&... args)
 
 ConcreteOperation (ConcreteOperation< ParallelOperation, from, Resp< void >, Args... > &&op)
 
Operation< HasHndl > * Move ()
 
ParallelOperation< true > operator>> (Hdlr &&hdlr)
 
ParallelOperation< true > operator| (FinalOperation &&fo)
 Adds a final operation to the pipeline. More...
 
ParallelOperation< true > operator| (Operation< false > &&op)
 
ParallelOperation< true > operator| (Operation< false > &op)
 
ParallelOperation< true > operator| (Operation< true > &&op)
 
ParallelOperation< true > operator| (Operation< true > &op)
 
ParallelOperation< HasHndl > Timeout (uint16_t timeout)
 Set operation timeout. More...
 
Operation< true > * ToHandled ()
 
- Public Member Functions inherited from XrdCl::Operation< HasHndl >
 Operation ()
 Constructor. More...
 
template<bool from>
 Operation (Operation< from > &&op)
 Move constructor between template instances. More...
 
virtual ~Operation ()
 Destructor. More...
 

Friends

template<bool >
class ParallelOperation
 

Additional Inherited Members

- Protected Member Functions inherited from XrdCl::ConcreteOperation< ParallelOperation, HasHndl, Resp< void > >
ParallelOperation< true > StreamImpl (ResponseHandler *handler)
 
ParallelOperation< to > Transform ()
 
- Protected Member Functions inherited from XrdCl::Operation< HasHndl >
void AddOperation (Operation< true > *op)
 
void Run (Timeout timeout, std::promise< XRootDStatus > prms, std::function< void(const XRootDStatus &)> final)
 
- Static Protected Member Functions inherited from XrdCl::ConcreteOperation< ParallelOperation, HasHndl, Resp< void > >
static void AllocHandler (ConcreteOperation< ParallelOperation, false, Resp< void >, Args... > &me)
 
static void AllocHandler (ConcreteOperation< ParallelOperation, true, Resp< void >, Args... > &me)
 
static ParallelOperation< true > PipeImpl (ConcreteOperation< ParallelOperation, HasHndl, Resp< void >, Args... > &me, Operation< false > &op)
 
static ParallelOperation< true > PipeImpl (ConcreteOperation< ParallelOperation, HasHndl, Resp< void >, Args... > &me, Operation< true > &op)
 
- Protected Attributes inherited from XrdCl::ConcreteOperation< ParallelOperation, HasHndl, Resp< void > >
std::tuple< Args... > args
 Operation arguments. More...
 
uint16_t timeout
 Operation timeout. More...
 
- Protected Attributes inherited from XrdCl::Operation< HasHndl >
std::unique_ptr< PipelineHandlerhandler
 Operation handler. More...
 
bool valid
 Flag indicating if it is a valid object. More...
 

Detailed Description

template<bool HasHndl>
class XrdCl::ParallelOperation< HasHndl >

Parallel operations, allows to execute two or more pipelines in parallel.

  • state : describes current operation configuration state (
    See also
    Operation)

Definition at line 79 of file XrdClParallelOperation.hh.

Constructor & Destructor Documentation

◆ ParallelOperation() [1/2]

template<bool HasHndl>
template<bool from>
XrdCl::ParallelOperation< HasHndl >::ParallelOperation ( ParallelOperation< from > &&  obj)
inline

Constructor: copy-move a ParallelOperation in different state.

Definition at line 89 of file XrdClParallelOperation.hh.

89  :
90  ConcreteOperation<ParallelOperation, HasHndl, Resp<void>>( std::move( obj ) ),
91  pipelines( std::move( obj.pipelines ) ),
92  policy( std::move( obj.policy ) )
93  {
94  }

◆ ParallelOperation() [2/2]

template<bool HasHndl>
template<class Container >
XrdCl::ParallelOperation< HasHndl >::ParallelOperation ( Container &&  container)
inline

Constructor

  • Container : iterable container type
Parameters
container: iterable container with pipelines

Definition at line 104 of file XrdClParallelOperation.hh.

105  {
106  static_assert( !HasHndl, "Constructor is available only operation without handler");
107 
108  pipelines.reserve( container.size() );
109  auto begin = std::make_move_iterator( container.begin() );
110  auto end = std::make_move_iterator( container.end() );
111  std::copy( begin, end, std::back_inserter( pipelines ) );
112  container.clear(); // there's junk inside so we clear it
113  }

◆ ~ParallelOperation()

template<bool HasHndl>
XrdCl::ParallelOperation< HasHndl >::~ParallelOperation ( )
inline

Definition at line 115 of file XrdClParallelOperation.hh.

116  {
117  }

Member Function Documentation

◆ All()

template<bool HasHndl>
ParallelOperation<HasHndl> XrdCl::ParallelOperation< HasHndl >::All ( )
inline

Set policy to All (default)

All operations need to succeed in order for the parallel operation to be successful.

Definition at line 144 of file XrdClParallelOperation.hh.

145  {
146  policy.reset( new AllPolicy() );
147  return std::move( *this );
148  }

◆ Any()

template<bool HasHndl>
ParallelOperation<HasHndl> XrdCl::ParallelOperation< HasHndl >::Any ( )
inline

Set policy to Any

Just one of the operations needs to succeed in order for the parallel operation to be successful.

Definition at line 156 of file XrdClParallelOperation.hh.

157  {
158  policy.reset( new AnyPolicy( pipelines.size() ) );
159  return std::move( *this );
160  }

◆ AtLeast()

template<bool HasHndl>
ParallelOperation<HasHndl> XrdCl::ParallelOperation< HasHndl >::AtLeast ( size_t  threshold)
inline

Set policy to At Least.

At least n (user defined) operations need to succeed in order for the parallel operation to be successful (the user handler will be called only when all operations are resolved).

Definition at line 181 of file XrdClParallelOperation.hh.

182  {
183  policy.reset( new AtLeastPolicy( pipelines.size(), threshold ) );
184  return std::move( *this );
185  }

◆ Some()

template<bool HasHndl>
ParallelOperation<HasHndl> XrdCl::ParallelOperation< HasHndl >::Some ( size_t  threshold)
inline

n (user defined) operations need to succeed in order for the parallel operation to be successful.

Definition at line 168 of file XrdClParallelOperation.hh.

169  {
170  policy.reset( new SomePolicy( pipelines.size(), threshold ) );
171  return std::move( *this );
172  }

◆ ToString()

template<bool HasHndl>
std::string XrdCl::ParallelOperation< HasHndl >::ToString ( )
inlinevirtual
Returns
: operation name

Implements XrdCl::Operation< HasHndl >.

Definition at line 122 of file XrdClParallelOperation.hh.

123  {
124  std::ostringstream oss;
125  oss << "Parallel(";
126  for( size_t i = 0; i < pipelines.size(); i++ )
127  {
128  oss << pipelines[i]->ToString();
129  if( i + 1 != pipelines.size() )
130  {
131  oss << " && ";
132  }
133  }
134  oss << ")";
135  return oss.str();
136  }

Friends And Related Function Documentation

◆ ParallelOperation

template<bool HasHndl>
template<bool >
friend class ParallelOperation
friend

Definition at line 81 of file XrdClParallelOperation.hh.


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