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 ) :
178 fun( handleFunction )
187 std::unique_ptr<XRootDStatus> delst( status );
188 std::unique_ptr<AnyObject> delrsp( response );
189 std::unique_ptr<HostList> delhl( hostList );
190 Response *res = GetResponse<Response>( status, response );
191 fun( *status, *res, *hostList );
229 fun( handleFunction )
238 std::unique_ptr<XRootDStatus> delst( status );
239 std::unique_ptr<AnyObject> delrsp( response );
240 std::unique_ptr<HostList> delhl( hostList );
241 fun( *status, *hostList );
257 template<
typename Response,
typename Return>
277 std::unique_ptr<XRootDStatus> delst( status );
278 std::unique_ptr<AnyObject> delrsp( response );
279 Response *resp = GetResponse<Response>( status, response );
280 task( *status, *resp );
298 template<
typename Return>
318 std::unique_ptr<XRootDStatus> delst( status );
319 std::unique_ptr<AnyObject> delrsp( response );
357 f(
f ),
fun( handleFunction )
367 std::unique_ptr<XRootDStatus> delst( status );
368 std::unique_ptr<StatInfo> delrsp;
369 std::unique_ptr<HostList> delhl;
374 delrsp.reset( info );
378 fun( *status, *info, *hostList );
425 const char*
what() const noexcept
452 template<
typename Response>
465 ftr =
prms.get_future();
486 prms.set_exception( ex );
502 template<
typename Response>
521 std::unique_ptr<XRootDStatus> delst( status );
522 std::unique_ptr<AnyObject> delrsp( response );
525 Response *resp = GetResponse<Response>( response );
530 this->
prms.set_value( std::move( *resp ) );
561 std::unique_ptr<XRootDStatus> delst( status );
562 std::unique_ptr<AnyObject> delrsp( response );
617 template<
typename Response>
660 template<
typename Response>
693 template<
typename Return>
742 template<
typename Return>
Definition XrdClAnyObject.hh:33
void Set(Type object, bool own=true)
Definition XrdClAnyObject.hh:59
void Get(Type &object)
Retrieve the object being held.
Definition XrdClAnyObject.hh:78
Lambda wrapper.
Definition XrdClOperationHandlers.hh:336
void HandleResponseWithHosts(XRootDStatus *status, AnyObject *response, HostList *hostList)
Callback method.
Definition XrdClOperationHandlers.hh:364
Ctx< File > f
Definition XrdClOperationHandlers.hh:382
ExOpenFuncWrapper(const Ctx< File > &f, std::function< void(XRootDStatus &, StatInfo &, HostList &)> handleFunction)
Constructor.
Definition XrdClOperationHandlers.hh:355
std::function< void(XRootDStatus &, StatInfo &, HostList &)> fun
user defined function, functor or lambda
Definition XrdClOperationHandlers.hh:386
ExOpenFuncWrapper(const Ctx< File > &f, std::function< void(XRootDStatus &, StatInfo &)> handleFunction)
Constructor.
Definition XrdClOperationHandlers.hh:344
FunctionWrapper(std::function< void(XRootDStatus &, HostList &)> handleFunction)
Constructor.
Definition XrdClOperationHandlers.hh:227
void HandleResponseWithHosts(XRootDStatus *status, AnyObject *response, HostList *hostList)
Callback method.
Definition XrdClOperationHandlers.hh:236
std::function< void(XRootDStatus &, HostList &)> fun
user defined function, functor or lambda
Definition XrdClOperationHandlers.hh:248
FunctionWrapper(std::function< void(XRootDStatus &)> handleFunction)
Constructor.
Definition XrdClOperationHandlers.hh:216
Definition XrdClOperationHandlers.hh:157
FunctionWrapper(std::function< void(XRootDStatus &, Response &, HostList &)> handleFunction)
Constructor.
Definition XrdClOperationHandlers.hh:176
std::function< void(XRootDStatus &, Response &, HostList &)> fun
user defined function, functor or lambda
Definition XrdClOperationHandlers.hh:198
FunctionWrapper(std::function< void(XRootDStatus &, Response &)> handleFunction)
Constructor.
Definition XrdClOperationHandlers.hh:165
void HandleResponseWithHosts(XRootDStatus *status, AnyObject *response, HostList *hostList)
Callback method.
Definition XrdClOperationHandlers.hh:185
Definition XrdClOperationHandlers.hh:454
bool fulfilled
Definition XrdClOperationHandlers.hh:494
void SetException(const XRootDStatus &err)
Definition XrdClOperationHandlers.hh:483
std::promise< Response > prms
promise that corresponds to the future
Definition XrdClOperationHandlers.hh:493
virtual ~FutureWrapperBase()
Destructor.
Definition XrdClOperationHandlers.hh:471
FutureWrapperBase(std::future< Response > &ftr)
Definition XrdClOperationHandlers.hh:463
FutureWrapper(std::future< void > &ftr)
Definition XrdClOperationHandlers.hh:552
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition XrdClOperationHandlers.hh:559
Definition XrdClOperationHandlers.hh:504
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition XrdClOperationHandlers.hh:519
FutureWrapper(std::future< Response > &ftr)
Definition XrdClOperationHandlers.hh:512
Pipeline exception, wrapps an XRootDStatus.
Definition XrdClOperationHandlers.hh:393
const XRootDStatus & GetError() const
Definition XrdClOperationHandlers.hh:433
PipelineException(const XRootDStatus &error)
Constructor from XRootDStatus.
Definition XrdClOperationHandlers.hh:399
XRootDStatus error
the XRootDStatus associated with this exception
Definition XrdClOperationHandlers.hh:443
PipelineException(const PipelineException &ex)
Copy constructor.
Definition XrdClOperationHandlers.hh:407
std::string strerr
Definition XrdClOperationHandlers.hh:444
PipelineException & operator=(const PipelineException &ex)
Assigment operator.
Definition XrdClOperationHandlers.hh:415
const char * what() const noexcept
inherited from std::exception
Definition XrdClOperationHandlers.hh:425
Wrapper class for raw response handler (ResponseHandler).
Definition XrdClOperationHandlers.hh:578
virtual void HandleResponseWithHosts(XRootDStatus *status, AnyObject *response, HostList *hostList)
Definition XrdClOperationHandlers.hh:596
ResponseHandler * handler
The actual operation handler (we don't own the pointer)
Definition XrdClOperationHandlers.hh:607
RawWrapper(ResponseHandler *handler)
Definition XrdClOperationHandlers.hh:586
Handle an async response.
Definition XrdClXRootDResponses.hh:1126
virtual void HandleResponseWithHosts(XRootDStatus *status, AnyObject *response, HostList *hostList)
Definition XrdClXRootDResponses.hh:1139
virtual void HandleResponse(XRootDStatus *status, AnyObject *response)
Definition XrdClXRootDResponses.hh:1155
Object stat info.
Definition XrdClXRootDResponses.hh:400
TaskWrapper(std::packaged_task< Return(XRootDStatus &)> &&task)
Constructor.
Definition XrdClOperationHandlers.hh:308
std::packaged_task< Return(XRootDStatus &)> task
user defined task
Definition XrdClOperationHandlers.hh:328
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition XrdClOperationHandlers.hh:316
Definition XrdClOperationHandlers.hh:259
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition XrdClOperationHandlers.hh:275
std::packaged_task< Return(XRootDStatus &, Response &)> task
user defined task
Definition XrdClOperationHandlers.hh:288
TaskWrapper(std::packaged_task< Return(XRootDStatus &, Response &)> &&task)
Constructor.
Definition XrdClOperationHandlers.hh:267
Helper class for unpacking single XAttrStatus from bulk response.
Definition XrdClOperationHandlers.hh:42
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition XrdClOperationHandlers.hh:52
ResponseHandler * handler
Definition XrdClOperationHandlers.hh:70
UnpackXAttrStatus(ResponseHandler *handler)
Definition XrdClOperationHandlers.hh:45
Helper class for unpacking single XAttr from bulk response.
Definition XrdClOperationHandlers.hh:77
ResponseHandler * handler
Definition XrdClOperationHandlers.hh:102
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition XrdClOperationHandlers.hh:87
UnpackXAttr(ResponseHandler *handler)
Definition XrdClOperationHandlers.hh:80
Request status.
Definition XrdClXRootDResponses.hh:219
Definition XrdClAction.hh:34
Response * GetResponse(AnyObject *rsp)
Definition XrdClOperationHandlers.hh:129
const uint16_t stError
An error occurred that could potentially be retried.
Definition XrdClStatus.hh:32
std::vector< HostInfo > HostList
Definition XrdClXRootDResponses.hh:1120
const uint16_t errInternal
Internal error.
Definition XrdClStatus.hh:56
const uint16_t errPipelineFailed
Pipeline failed and operation couldn't be executed.
Definition XrdClStatus.hh:66
Definition XrdOucJson.hh:4517
Utility class for storing a pointer to operation context.
Definition XrdClCtx.hh:39
Definition XrdClOperationHandlers.hh:112
static Response value
Definition XrdClOperationHandlers.hh:113
Definition XrdClOperationHandlers.hh:619
static ResponseHandler * Create(ResponseHandler *hdlr)
Definition XrdClOperationHandlers.hh:626
static ResponseHandler * Create(ResponseHandler &hdlr)
Definition XrdClOperationHandlers.hh:637
static ResponseHandler * Create(std::future< Response > &ftr)
Definition XrdClOperationHandlers.hh:648
static ResponseHandler * Create(std::packaged_task< Return(XRootDStatus &)> &task)
Definition XrdClOperationHandlers.hh:743
static ResponseHandler * Create(std::function< void(XRootDStatus &, HostList &)> func)
Definition XrdClOperationHandlers.hh:731
static ResponseHandler * Create(std::function< void(XRootDStatus &)> func)
Definition XrdClOperationHandlers.hh:720
Definition XrdClOperationHandlers.hh:662
static ResponseHandler * Create(std::packaged_task< Return(XRootDStatus &, Response &)> &task)
Definition XrdClOperationHandlers.hh:694
static ResponseHandler * Create(std::function< void(XRootDStatus &, Response &)> func)
Definition XrdClOperationHandlers.hh:669
static ResponseHandler * Create(std::function< void(XRootDStatus &, Response &, HostList &)> func)
Definition XrdClOperationHandlers.hh:681
uint16_t status
Status of the execution.
Definition XrdClStatus.hh:146
bool IsOK() const
We're fine.
Definition XrdClStatus.hh:124