Handle the stateful operations. More...
#include <XrdClFileStateHandler.hh>

Classes | |
| struct | RequestData |
Public Types | |
| enum | FileStatus { Closed, Opened, Error, Recovering, OpenInProgress, CloseInProgress } |
State of the file. More... | |
Public Member Functions | |
| FileStateHandler () | |
| Constructor. | |
| FileStateHandler (bool useVirtRedirector) | |
| ~FileStateHandler () | |
| Destructor. | |
| XRootDStatus | Open (const std::string &url, uint16_t flags, uint16_t mode, ResponseHandler *handler, uint16_t timeout=0) |
| XRootDStatus | Close (ResponseHandler *handler, uint16_t timeout=0) |
| XRootDStatus | Stat (bool force, ResponseHandler *handler, uint16_t timeout=0) |
| XRootDStatus | Read (uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, uint16_t timeout=0) |
| XRootDStatus | Write (uint64_t offset, uint32_t size, const void *buffer, ResponseHandler *handler, uint16_t timeout=0) |
| XRootDStatus | Sync (ResponseHandler *handler, uint16_t timeout=0) |
| XRootDStatus | Truncate (uint64_t size, ResponseHandler *handler, uint16_t timeout=0) |
| XRootDStatus | VectorRead (const ChunkList &chunks, void *buffer, ResponseHandler *handler, uint16_t timeout=0) |
| XRootDStatus | VectorWrite (const ChunkList &chunks, ResponseHandler *handler, uint16_t timeout=0) |
| XRootDStatus | WriteV (uint64_t offset, const struct iovec *iov, int iovcnt, ResponseHandler *handler, uint16_t timeout=0) |
| XRootDStatus | Fcntl (const Buffer &arg, ResponseHandler *handler, uint16_t timeout=0) |
| XRootDStatus | Visa (ResponseHandler *handler, uint16_t timeout=0) |
| void | OnOpen (const XRootDStatus *status, const OpenInfo *openInfo, const HostList *hostList) |
| Process the results of the opening operation. | |
| void | OnClose (const XRootDStatus *status) |
| Process the results of the closing operation. | |
| void | OnStateError (XRootDStatus *status, Message *message, ResponseHandler *userHandler, MessageSendParams &sendParams) |
| Handle an error while sending a stateful message. | |
| void | OnStateRedirection (const std::string &redirectUrl, Message *message, ResponseHandler *userHandler, MessageSendParams &sendParams) |
| Handle stateful redirect. | |
| void | OnStateResponse (XRootDStatus *status, Message *message, AnyObject *response, HostList *hostList) |
| Handle stateful response. | |
| bool | IsOpen () const |
| Check if the file is open. | |
| bool | SetProperty (const std::string &name, const std::string &value) |
| bool | GetProperty (const std::string &name, std::string &value) const |
| void | Lock () |
| Lock the internal lock. | |
| void | UnLock () |
| Unlock the internal lock. | |
| void | Tick (time_t now) |
| Tick. | |
| void | TimeOutRequests (time_t now) |
| Declare timeout on requests being recovered. | |
| void | AfterForkChild () |
| Called in the child process after the fork. | |
Private Types | |
| typedef std::list< RequestData > | RequestList |
Private Member Functions | |
| Status | SendOrQueue (const URL &url, Message *msg, ResponseHandler *handler, MessageSendParams &sendParams) |
| Send a message to a host or put it in the recovery queue. | |
| bool | IsRecoverable (const XRootDStatus &stataus) const |
| Check if the stateful error is recoverable. | |
| Status | RecoverMessage (RequestData rd, bool callbackOnFailure=true) |
| Status | RunRecovery () |
| Run the recovery procedure if appropriate. | |
| Status | SendClose (uint16_t timeout) |
| bool | IsReadOnly () const |
| Check if the file is open for read only. | |
| Status | ReOpenFileAtServer (const URL &url, uint16_t timeout) |
| Re-open the current file at a given server. | |
| void | FailMessage (RequestData rd, XRootDStatus status) |
| Fail a message. | |
| void | FailQueuedMessages (XRootDStatus status) |
| Fail queued messages. | |
| void | ReSendQueuedMessages () |
| Re-send queued messages. | |
| void | ReWriteFileHandle (Message *msg) |
| Re-write file handle. | |
| void | ResetMonitoringVars () |
| Reset monitoring vars. | |
| void | MonitorClose (const XRootDStatus *status) |
| Dispatch monitoring information on close. | |
| XRootDStatus | IssueRequest (const URL &url, Message *msg, ResponseHandler *handler, MessageSendParams &sendParams) |
Private Attributes | |
| XrdSysMutex | pMutex |
| FileStatus | pFileState |
| XRootDStatus | pStatus |
| StatInfo * | pStatInfo |
| URL * | pFileUrl |
| URL * | pDataServer |
| URL * | pLoadBalancer |
| URL * | pStateRedirect |
| uint8_t * | pFileHandle |
| uint16_t | pOpenMode |
| uint16_t | pOpenFlags |
| RequestList | pToBeRecovered |
| std::set< Message * > | pInTheFly |
| uint64_t | pSessionId |
| bool | pDoRecoverRead |
| bool | pDoRecoverWrite |
| bool | pFollowRedirects |
| bool | pUseVirtRedirector |
| timeval | pOpenTime |
| uint64_t | pRBytes |
| uint64_t | pVRBytes |
| uint64_t | pWBytes |
| uint64_t | pVWBytes |
| uint64_t | pVSegs |
| uint64_t | pRCount |
| uint64_t | pVRCount |
| uint64_t | pWCount |
| uint64_t | pVWCount |
| XRootDStatus | pCloseReason |
| ResponseHandlerHolder * | pReOpenHandler |
| LocalFileHandler * | pLFileHandler |
Handle the stateful operations.
typedef std::list<RequestData> XrdCl::FileStateHandler::RequestList [private] |
| XrdCl::FileStateHandler::FileStateHandler | ( | ) |
Constructor.
| XrdCl::FileStateHandler::FileStateHandler | ( | bool | useVirtRedirector | ) |
Constructor
| useVirtRedirector | if true Metalink files will be treated as a VirtualRedirectors |
| XrdCl::FileStateHandler::~FileStateHandler | ( | ) |
Destructor.
| void XrdCl::FileStateHandler::AfterForkChild | ( | ) |
Called in the child process after the fork.
| XRootDStatus XrdCl::FileStateHandler::Close | ( | ResponseHandler * | handler, | |
| uint16_t | timeout = 0 | |||
| ) |
Close the file object
| handler | handler to be notified about the status of the operation | |
| timeout | timeout value, if 0 the environment default will be used |
| void XrdCl::FileStateHandler::FailMessage | ( | RequestData | rd, | |
| XRootDStatus | status | |||
| ) | [private] |
Fail a message.
| void XrdCl::FileStateHandler::FailQueuedMessages | ( | XRootDStatus | status | ) | [private] |
Fail queued messages.
| XRootDStatus XrdCl::FileStateHandler::Fcntl | ( | const Buffer & | arg, | |
| ResponseHandler * | handler, | |||
| uint16_t | timeout = 0 | |||
| ) |
Performs a custom operation on an open file, server implementation dependent - async
| arg | query argument | |
| handler | handler to be notified when the response arrives, the response parameter will hold a Buffer object if the procedure is successful | |
| timeout | timeout value, if 0 the environment default will be used |
| bool XrdCl::FileStateHandler::GetProperty | ( | const std::string & | name, | |
| std::string & | value | |||
| ) | const |
Get file property
| bool XrdCl::FileStateHandler::IsOpen | ( | ) | const |
Check if the file is open.
| bool XrdCl::FileStateHandler::IsReadOnly | ( | ) | const [private] |
Check if the file is open for read only.
| bool XrdCl::FileStateHandler::IsRecoverable | ( | const XRootDStatus & | stataus | ) | const [private] |
Check if the stateful error is recoverable.
| XRootDStatus XrdCl::FileStateHandler::IssueRequest | ( | const URL & | url, | |
| Message * | msg, | |||
| ResponseHandler * | handler, | |||
| MessageSendParams & | sendParams | |||
| ) | [private] |
Issues request:
| void XrdCl::FileStateHandler::Lock | ( | ) | [inline] |
Lock the internal lock.
References XrdSysMutex::Lock(), and pMutex.
| void XrdCl::FileStateHandler::MonitorClose | ( | const XRootDStatus * | status | ) | [private] |
Dispatch monitoring information on close.
| void XrdCl::FileStateHandler::OnClose | ( | const XRootDStatus * | status | ) |
Process the results of the closing operation.
| void XrdCl::FileStateHandler::OnOpen | ( | const XRootDStatus * | status, | |
| const OpenInfo * | openInfo, | |||
| const HostList * | hostList | |||
| ) |
Process the results of the opening operation.
| void XrdCl::FileStateHandler::OnStateError | ( | XRootDStatus * | status, | |
| Message * | message, | |||
| ResponseHandler * | userHandler, | |||
| MessageSendParams & | sendParams | |||
| ) |
Handle an error while sending a stateful message.
| void XrdCl::FileStateHandler::OnStateRedirection | ( | const std::string & | redirectUrl, | |
| Message * | message, | |||
| ResponseHandler * | userHandler, | |||
| MessageSendParams & | sendParams | |||
| ) |
Handle stateful redirect.
| void XrdCl::FileStateHandler::OnStateResponse | ( | XRootDStatus * | status, | |
| Message * | message, | |||
| AnyObject * | response, | |||
| HostList * | hostList | |||
| ) |
Handle stateful response.
| XRootDStatus XrdCl::FileStateHandler::Open | ( | const std::string & | url, | |
| uint16_t | flags, | |||
| uint16_t | mode, | |||
| ResponseHandler * | handler, | |||
| uint16_t | timeout = 0 | |||
| ) |
Open the file pointed to by the given URL
| url | url of the file to be opened | |
| flags | OpenFlags::Flags | |
| mode | Access::Mode for new files, 0 otherwise | |
| handler | handler to be notified about the status of the operation | |
| timeout | timeout value, if 0 the environment default will be used |
| XRootDStatus XrdCl::FileStateHandler::Read | ( | uint64_t | offset, | |
| uint32_t | size, | |||
| void * | buffer, | |||
| ResponseHandler * | handler, | |||
| uint16_t | timeout = 0 | |||
| ) |
Read a data chunk at a given offset - sync
| offset | offset from the beginning of the file | |
| size | number of bytes to be read | |
| buffer | a pointer to a buffer big enough to hold the data or 0 if the buffer should be allocated by the system | |
| handler | handler to be notified when the response arrives, the response parameter will hold a buffer object if the procedure was successful, if a preallocated buffer was specified then the buffer object will "wrap" this buffer | |
| timeout | timeout value, if 0 the environment default will be used |
| Status XrdCl::FileStateHandler::RecoverMessage | ( | RequestData | rd, | |
| bool | callbackOnFailure = true | |||
| ) | [private] |
Recover a message
| rd | request data associated with the message | |
| callbackOnFailure | should the current handler be called back if the recovery procedure fails |
Re-open the current file at a given server.
| void XrdCl::FileStateHandler::ReSendQueuedMessages | ( | ) | [private] |
Re-send queued messages.
| void XrdCl::FileStateHandler::ResetMonitoringVars | ( | ) | [inline, private] |
| void XrdCl::FileStateHandler::ReWriteFileHandle | ( | Message * | msg | ) | [private] |
Re-write file handle.
| Status XrdCl::FileStateHandler::RunRecovery | ( | ) | [private] |
Run the recovery procedure if appropriate.
| Status XrdCl::FileStateHandler::SendClose | ( | uint16_t | timeout | ) | [private] |
| Status XrdCl::FileStateHandler::SendOrQueue | ( | const URL & | url, | |
| Message * | msg, | |||
| ResponseHandler * | handler, | |||
| MessageSendParams & | sendParams | |||
| ) | [private] |
Send a message to a host or put it in the recovery queue.
| bool XrdCl::FileStateHandler::SetProperty | ( | const std::string & | name, | |
| const std::string & | value | |||
| ) |
Set file property
| XRootDStatus XrdCl::FileStateHandler::Stat | ( | bool | force, | |
| ResponseHandler * | handler, | |||
| uint16_t | timeout = 0 | |||
| ) |
Obtain status information for this file - async
| force | do not use the cached information, force re-stating | |
| handler | handler to be notified when the response arrives, the response parameter will hold a StatInfo object if the procedure is successful | |
| timeout | timeout value, if 0 the environment default will be used |
| XRootDStatus XrdCl::FileStateHandler::Sync | ( | ResponseHandler * | handler, | |
| uint16_t | timeout = 0 | |||
| ) |
Commit all pending disk writes - async
| handler | handler to be notified when the response arrives | |
| timeout | timeout value, if 0 the environment default will be used |
| void XrdCl::FileStateHandler::Tick | ( | time_t | now | ) |
Tick.
| void XrdCl::FileStateHandler::TimeOutRequests | ( | time_t | now | ) |
Declare timeout on requests being recovered.
| XRootDStatus XrdCl::FileStateHandler::Truncate | ( | uint64_t | size, | |
| ResponseHandler * | handler, | |||
| uint16_t | timeout = 0 | |||
| ) |
Truncate the file to a particular size - async
| size | desired size of the file | |
| handler | handler to be notified when the response arrives | |
| timeout | timeout value, if 0 the environment default will be used |
| void XrdCl::FileStateHandler::UnLock | ( | ) | [inline] |
Unlock the internal lock.
References pMutex, and XrdSysMutex::UnLock().
| XRootDStatus XrdCl::FileStateHandler::VectorRead | ( | const ChunkList & | chunks, | |
| void * | buffer, | |||
| ResponseHandler * | handler, | |||
| uint16_t | timeout = 0 | |||
| ) |
Read scattered data chunks in one operation - async
| chunks | list of the chunks to be read | |
| buffer | a pointer to a buffer big enough to hold the data | |
| handler | handler to be notified when the response arrives | |
| timeout | timeout value, if 0 then the environment default will be used |
| XRootDStatus XrdCl::FileStateHandler::VectorWrite | ( | const ChunkList & | chunks, | |
| ResponseHandler * | handler, | |||
| uint16_t | timeout = 0 | |||
| ) |
Write scattered data chunks in one operation - async
| chunks | list of the chunks to be read | |
| handler | handler to be notified when the response arrives | |
| timeout | timeout value, if 0 then the environment default will be used |
| XRootDStatus XrdCl::FileStateHandler::Visa | ( | ResponseHandler * | handler, | |
| uint16_t | timeout = 0 | |||
| ) |
Get access token to a file - async
| handler | handler to be notified when the response arrives, the response parameter will hold a Buffer object if the procedure is successful | |
| timeout | timeout value, if 0 the environment default will be used |
| XRootDStatus XrdCl::FileStateHandler::Write | ( | uint64_t | offset, | |
| uint32_t | size, | |||
| const void * | buffer, | |||
| ResponseHandler * | handler, | |||
| uint16_t | timeout = 0 | |||
| ) |
Write a data chunk at a given offset - async
| offset | offset from the beginning of the file | |
| size | number of bytes to be written | |
| buffer | a pointer to the buffer holding the data to be written | |
| handler | handler to be notified when the response arrives | |
| timeout | timeout value, if 0 the environment default will be used |
| XRootDStatus XrdCl::FileStateHandler::WriteV | ( | uint64_t | offset, | |
| const struct iovec * | iov, | |||
| int | iovcnt, | |||
| ResponseHandler * | handler, | |||
| uint16_t | timeout = 0 | |||
| ) |
Write scattered buffers in one operation - async
| offset | offset from the beginning of the file | |
| iov | list of the buffers to be written | |
| iovcnt | number of buffers | |
| handler | handler to be notified when the response arrives | |
| timeout | timeout value, if 0 then the environment default will be used |
Referenced by ResetMonitoringVars().
URL* XrdCl::FileStateHandler::pDataServer [private] |
bool XrdCl::FileStateHandler::pDoRecoverRead [private] |
bool XrdCl::FileStateHandler::pDoRecoverWrite [private] |
uint8_t* XrdCl::FileStateHandler::pFileHandle [private] |
URL* XrdCl::FileStateHandler::pFileUrl [private] |
bool XrdCl::FileStateHandler::pFollowRedirects [private] |
std::set<Message*> XrdCl::FileStateHandler::pInTheFly [private] |
URL* XrdCl::FileStateHandler::pLoadBalancer [private] |
XrdSysMutex XrdCl::FileStateHandler::pMutex [mutable, private] |
uint16_t XrdCl::FileStateHandler::pOpenFlags [private] |
uint16_t XrdCl::FileStateHandler::pOpenMode [private] |
timeval XrdCl::FileStateHandler::pOpenTime [private] |
Referenced by ResetMonitoringVars().
uint64_t XrdCl::FileStateHandler::pRBytes [private] |
Referenced by ResetMonitoringVars().
uint64_t XrdCl::FileStateHandler::pRCount [private] |
Referenced by ResetMonitoringVars().
ResponseHandlerHolder* XrdCl::FileStateHandler::pReOpenHandler [private] |
uint64_t XrdCl::FileStateHandler::pSessionId [private] |
URL* XrdCl::FileStateHandler::pStateRedirect [private] |
StatInfo* XrdCl::FileStateHandler::pStatInfo [private] |
XRootDStatus XrdCl::FileStateHandler::pStatus [private] |
bool XrdCl::FileStateHandler::pUseVirtRedirector [private] |
uint64_t XrdCl::FileStateHandler::pVRBytes [private] |
Referenced by ResetMonitoringVars().
uint64_t XrdCl::FileStateHandler::pVRCount [private] |
Referenced by ResetMonitoringVars().
uint64_t XrdCl::FileStateHandler::pVSegs [private] |
Referenced by ResetMonitoringVars().
uint64_t XrdCl::FileStateHandler::pVWBytes [private] |
uint64_t XrdCl::FileStateHandler::pVWCount [private] |
uint64_t XrdCl::FileStateHandler::pWBytes [private] |
Referenced by ResetMonitoringVars().
uint64_t XrdCl::FileStateHandler::pWCount [private] |
Referenced by ResetMonitoringVars().
1.6.1