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 );
206 fun( handleFunction )
215 std::unique_ptr<XRootDStatus> delst( status );
216 std::unique_ptr<AnyObject> delrsp( response );
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 );
274 template<
typename Return>
294 std::unique_ptr<XRootDStatus> delst( status );
295 std::unique_ptr<AnyObject> delrsp( response );
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 );
388 const char*
what() const noexcept
414 template<
typename Response>
427 ftr =
prms.get_future();
448 prms.set_exception( ex );
464 template<
typename Response>
483 std::unique_ptr<XRootDStatus> delst( status );
484 std::unique_ptr<AnyObject> delrsp( response );
487 Response *resp = GetResponse<Response>( response );
492 this->
prms.set_value( std::move( *resp ) );
523 std::unique_ptr<XRootDStatus> delst( status );
524 std::unique_ptr<AnyObject> delrsp( response );
579 template<
typename Response>
622 template<
typename Response>
643 template<
typename Return>
681 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:312
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:329
Ctx< File > f
Definition: XrdClOperationHandlers.hh:346
std::function< void(XRootDStatus &, StatInfo &)> fun
user defined function, functor or lambda
Definition: XrdClOperationHandlers.hh:350
ExOpenFuncWrapper(const Ctx< File > &f, std::function< void(XRootDStatus &, StatInfo &)> handleFunction)
Constructor.
Definition: XrdClOperationHandlers.hh:320
Definition: XrdClOperationHandlers.hh:196
std::function< void(XRootDStatus &)> fun
user defined function, functor or lambda
Definition: XrdClOperationHandlers.hh:224
FunctionWrapper(std::function< void(XRootDStatus &)> handleFunction)
Constructor.
Definition: XrdClOperationHandlers.hh:204
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:213
Definition: XrdClOperationHandlers.hh:157
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:174
std::function< void(XRootDStatus &, Response &)> fun
user defined function, functor or lambda
Definition: XrdClOperationHandlers.hh:186
FunctionWrapper(std::function< void(XRootDStatus &, Response &)> handleFunction)
Constructor.
Definition: XrdClOperationHandlers.hh:165
Definition: XrdClOperationHandlers.hh:416
bool fulfilled
Definition: XrdClOperationHandlers.hh:456
void SetException(const XRootDStatus &err)
Definition: XrdClOperationHandlers.hh:445
std::promise< Response > prms
promise that corresponds to the future
Definition: XrdClOperationHandlers.hh:455
virtual ~FutureWrapperBase()
Destructor.
Definition: XrdClOperationHandlers.hh:433
FutureWrapperBase(std::future< Response > &ftr)
Definition: XrdClOperationHandlers.hh:425
FutureWrapper(std::future< void > &ftr)
Definition: XrdClOperationHandlers.hh:514
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:521
Definition: XrdClOperationHandlers.hh:466
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:481
FutureWrapper(std::future< Response > &ftr)
Definition: XrdClOperationHandlers.hh:474
Pipeline exception, wrapps an XRootDStatus.
Definition: XrdClOperationHandlers.hh:357
PipelineException & operator=(const PipelineException &ex)
Assigment operator.
Definition: XrdClOperationHandlers.hh:379
PipelineException(const XRootDStatus &error)
Constructor from XRootDStatus.
Definition: XrdClOperationHandlers.hh:363
XRootDStatus error
the XRootDStatus associated with this exception
Definition: XrdClOperationHandlers.hh:406
PipelineException(const PipelineException &ex)
Copy constructor.
Definition: XrdClOperationHandlers.hh:371
const char * what() const noexcept
inherited from std::exception
Definition: XrdClOperationHandlers.hh:388
const XRootDStatus & GetError() const
Definition: XrdClOperationHandlers.hh:396
Wrapper class for raw response handler (ResponseHandler).
Definition: XrdClOperationHandlers.hh:540
virtual void HandleResponseWithHosts(XRootDStatus *status, AnyObject *response, HostList *hostList)
Definition: XrdClOperationHandlers.hh:558
ResponseHandler * handler
The actual operation handler (we don't own the pointer)
Definition: XrdClOperationHandlers.hh:569
RawWrapper(ResponseHandler *handler)
Definition: XrdClOperationHandlers.hh:548
Handle an async response.
Definition: XrdClXRootDResponses.hh:1037
virtual void HandleResponseWithHosts(XRootDStatus *status, AnyObject *response, HostList *hostList)
Definition: XrdClXRootDResponses.hh:1050
virtual void HandleResponse(XRootDStatus *status, AnyObject *response)
Definition: XrdClXRootDResponses.hh:1066
Object stat info.
Definition: XrdClXRootDResponses.hh:396
Definition: XrdClOperationHandlers.hh:276
TaskWrapper(std::packaged_task< Return(XRootDStatus &)> &&task)
Constructor.
Definition: XrdClOperationHandlers.hh:284
std::packaged_task< Return(XRootDStatus &)> task
user defined task
Definition: XrdClOperationHandlers.hh:304
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:292
Definition: XrdClOperationHandlers.hh:235
void HandleResponse(XRootDStatus *status, AnyObject *response)
Callback method.
Definition: XrdClOperationHandlers.hh:251
std::packaged_task< Return(XRootDStatus &, Response &)> task
user defined task
Definition: XrdClOperationHandlers.hh:264
TaskWrapper(std::packaged_task< Return(XRootDStatus &, Response &)> &&task)
Constructor.
Definition: XrdClOperationHandlers.hh:243
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:215
Definition: XrdClAnyObject.hh:26
const uint16_t stError
An error occurred that could potentially be retried.
Definition: XrdClStatus.hh:32
std::vector< HostInfo > HostList
Definition: XrdClXRootDResponses.hh:1031
const uint16_t errInternal
Internal error.
Definition: XrdClStatus.hh:55
const uint16_t errPipelineFailed
Pipeline failed and operation couldn't be executed.
Definition: XrdClStatus.hh:65
Response * GetResponse(AnyObject *rsp)
Definition: XrdClOperationHandlers.hh:129
Utility class for storing a pointer to operation context.
Definition: XrdClCtx.hh:38
Definition: XrdClOperationHandlers.hh:112
static Response value
Definition: XrdClOperationHandlers.hh:113
Definition: XrdClOperationHandlers.hh:581
static ResponseHandler * Create(std::future< Response > &ftr)
Definition: XrdClOperationHandlers.hh:610
static ResponseHandler * Create(ResponseHandler *hdlr)
Definition: XrdClOperationHandlers.hh:588
static ResponseHandler * Create(ResponseHandler &hdlr)
Definition: XrdClOperationHandlers.hh:599
static ResponseHandler * Create(std::packaged_task< Return(XRootDStatus &)> &task)
Definition: XrdClOperationHandlers.hh:682
static ResponseHandler * Create(std::function< void(XRootDStatus &)> func)
Definition: XrdClOperationHandlers.hh:670
Definition: XrdClOperationHandlers.hh:624
static ResponseHandler * Create(std::packaged_task< Return(XRootDStatus &, Response &)> &task)
Definition: XrdClOperationHandlers.hh:644
static ResponseHandler * Create(std::function< void(XRootDStatus &, Response &)> func)
Definition: XrdClOperationHandlers.hh:631
uint16_t status
Status of the execution.
Definition: XrdClStatus.hh:137
bool IsOK() const
We're fine.
Definition: XrdClStatus.hh:120
std::string ToString() const
Create a string representation.