xrootd
Loading...
Searching...
No Matches
Public Member Functions | List of all members
XrdXrootd::Bridge::Result Class Referenceabstract

#include <XrdXrootdBridge.hh>

Inheritance diagram for XrdXrootd::Bridge::Result:
Inheritance graph
[legend]

Public Member Functions

virtual bool Data (Bridge::Context &info, const struct iovec *iovP, int iovN, int iovL, bool final)=0
 
virtual bool Done (Bridge::Context &info)=0
 the result context
 
virtual bool Error (Bridge::Context &info, int ecode, const char *etext)=0
 
virtual int File (Bridge::Context &info, int dlen)=0
 
virtual void Free (Bridge::Context &info, char *buffP, int buffL)
 
virtual bool Redir (Bridge::Context &info, int port, const char *hname)=0
 
virtual bool Wait (Bridge::Context &info, int wtime, const char *wtext)
 
virtual Bridge::ResultWaitResp (Bridge::Context &info, int wtime, const char *wtext)
 
 Result ()
 Constructor & Destructor.
 
virtual ~Result ()
 

Detailed Description

Handle xroot protocol execution results.

The Result object is an abstract class that defines the interface used by the xroot protocol stack to effect a client response using whatever alternate protocol is needed. You must define an implementation and pass it as an argument to the Login() Bridge method.

Constructor & Destructor Documentation

◆ Result()

XrdXrootd::Bridge::Result::Result ( )
inline

Constructor & Destructor.

◆ ~Result()

virtual XrdXrootd::Bridge::Result::~Result ( )
inlinevirtual

Member Function Documentation

◆ Data()

virtual bool XrdXrootd::Bridge::Result::Data ( Bridge::Context info,
const struct iovec *  iovP,
int  iovN,
int  iovL,
bool  final 
)
pure virtual

Effect a client data response.

The Data() method is called when Run() resulted in a successful data response. The method should rewrite the data and send it to the client using the associated XrdLink object. As an example, 1) Result::Data(info, iovP, iovN, iovL) is called. 2) Inspect iovP, rewrite the data. 3) Send the response: info->linkP->Send(new_iovP, new_iovN, new_iovL); 4) Handle send errors and cleanup(e.g. deallocate storage). 5) Return, the exchange is now complete.

Parameters
infothe context associated with the result.
iovPa pointer to the iovec structure containing the xrootd data response about to be sent to the client. The request header is not included in the iovec structure. The elements of this structure must not be modified by the method.
iovNthe number of elements in the iovec structure array.
iovLtotal number of data bytes that would be sent to the client. This is simply the sum of all the lengths in the iovec.
finalTrue is this is the final result. Otherwise, this is a partial result (i.e. kXR_oksofar) and more data will result causing additional callbacks. For write requests, any supplied data buffer may now be reused or freed.
Returns
true continue normal processing. false terminate the bridge and close the link.
Parameters
infothe result context
iovPpointer to data array
iovNarray count
iovLbyte count
finaltrue -> final result

Implemented in XrdHttpReq.

◆ Done()

virtual bool XrdXrootd::Bridge::Result::Done ( Bridge::Context info)
pure virtual

the result context

Effect a client acknowledgement.

The Done() method is called when Run() resulted in success and there is no associated data for the client (equivalent to a simple kXR_ok response).

Parameters
infothe context associated with the result.
Returns
true continue normal processing. false terminate the bridge and close the link.

Implemented in XrdHttpReq.

◆ Error()

virtual bool XrdXrootd::Bridge::Result::Error ( Bridge::Context info,
int  ecode,
const char *  etext 
)
pure virtual

Effect a client error response.

The Error() method is called when an error was encountered while processing the Run() request. The error should be reflected to the client.

Parameters
infothe context associated with the result.
ecodethe "kXR" error code describing the nature of the error. The code is in host byte format.
etexta null terminated string describing the error in human terms
Returns
true continue normal processing. false terminate the bridge and close the link.
Parameters
infothe result context
ecodethe "kXR" error code
etextassociated error message

Implemented in XrdHttpReq.

◆ File()

virtual int XrdXrootd::Bridge::Result::File ( Bridge::Context info,
int  dlen 
)
pure virtual

Notify callback that a sendfile() request is pending.

The File() method is called when Run() resulted in a sendfile response (i.e. sendfile() would have been used to send data to the client). This allows the callback to reframe the sendfile() data using the Send() method in the passed context object (see class Context above).

Parameters
infothe context associated with the result.
dlentotal number of data bytes that would be sent to the client.
Returns
true continue normal processing. false terminate the bridge and close the link.
Parameters
infothe result context
dlenbyte count

Implemented in XrdHttpReq.

◆ Free()

virtual void XrdXrootd::Bridge::Result::Free ( Bridge::Context info,
char *  buffP,
int  buffL 
)
inlinevirtual

Notify callback that a write buffer is now available for reuse.

The Free() method is called when Run() was called to write data and a buffer was supplied. Normally, he buffer is pinned and cannot be reused until the write completes. This callback provides the notification that the buffer is no longer in use. The callback is invoked prior to any other callbacks and is only invoked if a buffer was supplied.

Parameters
infothe context associated with this call.
buffPpointer to the buffer.
buffLthe length originally supplied in the Run() call.
Parameters
infothe result context
buffPpointer to the buffer
buffLoriginal length to Run()

◆ Redir()

virtual bool XrdXrootd::Bridge::Result::Redir ( Bridge::Context info,
int  port,
const char *  hname 
)
pure virtual

Redirect the client to another host:port.

The Redir() method is called when the client must be redirected to another host.

Parameters
infothe context associated with the result.
portthe port number in host byte format.
hnamethe DNS name of the host or IP address is IPV4 or IPV6 format (i.e. "n.n.n.n" or "[ipv6_addr]").
Returns
true continue normal processing. false terminate the bridge and close the link.
Parameters
infothe result context
portthe port number
hnamethe destination host

Implemented in XrdHttpReq.

◆ Wait()

virtual bool XrdXrootd::Bridge::Result::Wait ( Bridge::Context info,
int  wtime,
const char *  wtext 
)
inlinevirtual

Effect a client wait.

The Wait() method is called when Run() needs to delay a request. Normally, delays are internally handled. However, you can request that delays be reflected via a callback using the Bridge SetWait() method.

Parameters
infothe context associated with the result.
wtimethe number of seconds to delay the request.
wtexta null terminated string describing the wait in human terms
Returns
true continue normal processing. false terminate the bridge and close the link.
Parameters
infothe result context
wtimethe wait time
wtextassociated message

◆ WaitResp()

virtual Bridge::Result * XrdXrootd::Bridge::Result::WaitResp ( Bridge::Context info,
int  wtime,
const char *  wtext 
)
inlinevirtual

Effect a client wait response (waitresp) NOT CURRENTLY IMPLEMENTED!

The WaitResp() method is called when an operation ended with a wait for response (waitresp) condition. The wait for response condition indicates that the actual response will be delivered at a later time. You can use context object to determine the operation being delayed. This callback provides you the opportunity to say how the waitresp is to be handled.

Parameters
infothe context associated with the result.
wtimethe number of seconds in which a response is expected.
wtexta null terminated string describing the delay in human terms
Returns
!0 pointer to the callback object whose appropriate method should be called when the actual response is generated.
0 the waitresp will be handled by the bridge application. The application is responsible for re-issuing the request when the final response is a wait.
Parameters
infothe result context
wtimethe wait time
wtextassociated message

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