26 #ifndef __XRD_CL_OPERATION_HANDLERS_HH__
27 #define __XRD_CL_OPERATION_HANDLERS_HH__
61 std::vector<XAttrStatus> *bulk =
nullptr;
62 response->
Get( bulk );
63 *status = bulk->front().
status;
91 std::vector<XAttr> *bulk =
nullptr;
92 response->
Get( bulk );
93 *status = bulk->front().
status;
94 std::string *rsp =
new std::string( std::move( bulk->front().value ) );
110 template<
typename Response>
119 template<
typename Response>
128 template<
typename Response>
131 Response *ret =
nullptr;
143 template<
typename Response>
147 return GetResponse<Response>( rsp );
155 template<
typename Response>
166 std::function<
void(
XRootDStatus&, Response& )> handleFunction ) :
167 fun( handleFunction )
176 std::unique_ptr<XRootDStatus> delst( status );
177 std::unique_ptr<AnyObject> delrsp( response );
178 Response *res = GetResponse<Response>( status, response );
179 fun( *status, *res );
186 std::function<void( XRootDStatus&, Response& )>
fun;
206 fun( handleFunction )
215 std::unique_ptr<XRootDStatus> delst( status );
216 std::unique_ptr<AnyObject> delrsp( response );
224 std::function<void( XRootDStatus& )>
fun;
233 template<
typename Response,
typename Return>
253 std::unique_ptr<XRootDStatus> delst( status );
254 std::unique_ptr<AnyObject> delrsp( response );
255 Response *resp = GetResponse<Response>( status, response );
256 task( *status, *resp );
264 std::packaged_task<Return( XRootDStatus&, Response& )>
task;
274 template<
typename Return>
294 std::unique_ptr<XRootDStatus> delst( status );
295 std::unique_ptr<AnyObject> delrsp( response );
304 std::packaged_task<Return( XRootDStatus& )>
task;
322 f( f ),
fun( handleFunction )
332 std::unique_ptr<XRootDStatus> delst( status );
333 std::unique_ptr<StatInfo> delrsp;
338 delrsp.reset( info );
342 fun( *status, *info );
350 std::function<void( XRootDStatus&, StatInfo& )>
fun;
389 const char*
what() const noexcept
416 template<
typename Response>
429 ftr =
prms.get_future();
450 prms.set_exception( ex );
466 template<
typename Response>
485 std::unique_ptr<XRootDStatus> delst( status );
486 std::unique_ptr<AnyObject> delrsp( response );
489 Response *resp = GetResponse<Response>( response );
494 this->
prms.set_value( std::move( *resp ) );
525 std::unique_ptr<XRootDStatus> delst( status );
526 std::unique_ptr<AnyObject> delrsp( response );
581 template<
typename Response>
624 template<
typename Response>
645 template<
typename Return>
683 template<
typename Return>
696 #endif // __XRD_CL_OPERATIONS_HANDLERS_HH__
ExOpenFuncWrapper(const Ctx< File > &f, std::function< void(XRootDStatus &, StatInfo &)> handleFunction)
Constructor.
Definition: XrdClOperationHandlers.hh:320
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:292
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:213
TaskWrapper(std::packaged_task< Return(XRootDStatus &, Response &)> &&task)
Constructor.
Definition: XrdClOperationHandlers.hh:243
Definition: XrdClAnyObject.hh:32
static ResponseHandler * Create(ResponseHandler &hdlr)
Definition: XrdClOperationHandlers.hh:601
Utility class for storing a pointer to operation context.
Definition: XrdClCtx.hh:37
virtual void HandleResponseWithHosts(XRootDStatus *status, AnyObject *response, HostList *hostList)
Definition: XrdClOperationHandlers.hh:560
const char * what() const noexcept
inherited from std::exception
Definition: XrdClOperationHandlers.hh:389
void Get(Type &object)
Retrieve the object being held.
Definition: XrdClAnyObject.hh:78
Object stat info.
Definition: XrdClXRootDResponses.hh:399
Definition: XrdClOperationHandlers.hh:417
static ResponseHandler * Create(std::future< Response > &ftr)
Definition: XrdClOperationHandlers.hh:612
std::promise< Response > prms
promise that corresponds to the future
Definition: XrdClOperationHandlers.hh:457
Definition: XrdClOperationHandlers.hh:111
std::function< void(XRootDStatus &, StatInfo &)> fun
user defined function, functor or lambda
Definition: XrdClOperationHandlers.hh:350
static ResponseHandler * Create(std::packaged_task< Return(XRootDStatus &, Response &)> &task)
Definition: XrdClOperationHandlers.hh:646
static Response value
Definition: XrdClOperationHandlers.hh:113
Definition: XrdClOperationHandlers.hh:195
RawWrapper(ResponseHandler *handler)
Definition: XrdClOperationHandlers.hh:550
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:52
PipelineException(const PipelineException &ex)
Copy constructor.
Definition: XrdClOperationHandlers.hh:371
const XRootDStatus & GetError() const
Definition: XrdClOperationHandlers.hh:397
uint16_t status
Status of the execution.
Definition: XrdClStatus.hh:145
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:251
Definition: XrdClOperationHandlers.hh:234
FunctionWrapper(std::function< void(XRootDStatus &)> handleFunction)
Constructor.
Definition: XrdClOperationHandlers.hh:204
Definition: XrdClOperationHandlers.hh:625
std::function< void(XRootDStatus &, Response &)> fun
user defined function, functor or lambda
Definition: XrdClOperationHandlers.hh:186
Definition: XrdClOperationHandlers.hh:275
TaskWrapper(std::packaged_task< Return(XRootDStatus &)> &&task)
Constructor.
Definition: XrdClOperationHandlers.hh:284
FutureWrapper(std::future< Response > &ftr)
Definition: XrdClOperationHandlers.hh:476
void SetException(const XRootDStatus &err)
Definition: XrdClOperationHandlers.hh:447
Pipeline exception, wrapps an XRootDStatus.
Definition: XrdClOperationHandlers.hh:356
std::string strerr
Definition: XrdClOperationHandlers.hh:408
std::vector< HostInfo > HostList
Definition: XrdClXRootDResponses.hh:1111
Helper class for unpacking single XAttr from bulk response.
Definition: XrdClOperationHandlers.hh:76
Definition: XrdClOperationHandlers.hh:467
void Set(Type object, bool own=true)
Definition: XrdClAnyObject.hh:59
const uint16_t stError
An error occurred that could potentially be retried.
Definition: XrdClStatus.hh:32
PipelineException & operator=(const PipelineException &ex)
Assigment operator.
Definition: XrdClOperationHandlers.hh:379
Request status.
Definition: XrdClXRootDResponses.hh:218
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:174
static ResponseHandler * Create(std::function< void(XRootDStatus &, Response &)> func)
Definition: XrdClOperationHandlers.hh:633
std::packaged_task< Return(XRootDStatus &, Response &)> task
user defined task
Definition: XrdClOperationHandlers.hh:264
j template void())
Definition: XrdOucJson.hh:4121
const uint16_t errPipelineFailed
Pipeline failed and operation couldn't be executed.
Definition: XrdClStatus.hh:66
std::packaged_task< Return(XRootDStatus &)> task
user defined task
Definition: XrdClOperationHandlers.hh:304
Definition: XrdClOperationHandlers.hh:582
Lambda wrapper.
Definition: XrdClOperationHandlers.hh:311
static ResponseHandler * Create(std::packaged_task< Return(XRootDStatus &)> &task)
Definition: XrdClOperationHandlers.hh:684
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:87
UnpackXAttrStatus(ResponseHandler *handler)
Definition: XrdClOperationHandlers.hh:45
Handle an async response.
Definition: XrdClXRootDResponses.hh:1116
Helper class for unpacking single XAttrStatus from bulk response.
Definition: XrdClOperationHandlers.hh:41
ResponseHandler * handler
The actual operation handler (we don't own the pointer)
Definition: XrdClOperationHandlers.hh:571
virtual void HandleResponse(XRootDStatus *status, AnyObject *response)
Definition: XrdClXRootDResponses.hh:1146
Wrapper class for raw response handler (ResponseHandler).
Definition: XrdClOperationHandlers.hh:541
ResponseHandler * handler
Definition: XrdClOperationHandlers.hh:102
virtual void HandleResponseWithHosts(XRootDStatus *status, AnyObject *response, HostList *hostList)
Definition: XrdClXRootDResponses.hh:1130
Response * GetResponse(AnyObject *rsp)
Definition: XrdClOperationHandlers.hh:129
static ResponseHandler * Create(ResponseHandler *hdlr)
Definition: XrdClOperationHandlers.hh:590
const uint16_t errInternal
Internal error.
Definition: XrdClStatus.hh:56
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:523
XRootDStatus error
the XRootDStatus associated with this exception
Definition: XrdClOperationHandlers.hh:407
ResponseHandler * handler
Definition: XrdClOperationHandlers.hh:70
std::function< void(XRootDStatus &)> fun
user defined function, functor or lambda
Definition: XrdClOperationHandlers.hh:224
FunctionWrapper(std::function< void(XRootDStatus &, Response &)> handleFunction)
Constructor.
Definition: XrdClOperationHandlers.hh:165
FutureWrapperBase(std::future< Response > &ftr)
Definition: XrdClOperationHandlers.hh:427
Definition: XrdClOperationHandlers.hh:156
PipelineException(const XRootDStatus &error)
Constructor from XRootDStatus.
Definition: XrdClOperationHandlers.hh:363
Ctx< File > f
Definition: XrdClOperationHandlers.hh:346
UnpackXAttr(ResponseHandler *handler)
Definition: XrdClOperationHandlers.hh:80
bool IsOK() const
We're fine.
Definition: XrdClStatus.hh:123
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:329
FutureWrapper(std::future< void > &ftr)
Definition: XrdClOperationHandlers.hh:516
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:483
bool fulfilled
Definition: XrdClOperationHandlers.hh:458
virtual ~FutureWrapperBase()
Destructor.
Definition: XrdClOperationHandlers.hh:435
static ResponseHandler * Create(std::function< void(XRootDStatus &)> func)
Definition: XrdClOperationHandlers.hh:672