library: libNetx #include "TXNetFile.h" |
TXNetFile
class description - header file - source file - inheritance tree (.pdf)
private:
void CreateXClient(const char* url, Option_t* option, Int_t netopt, Bool_t parallelopen)
static void FormUrl(TUrl uut, TString& uu)
static Int_t GetRootdProtocol(TSocket* s)
virtual void Init(Bool_t create)
Bool_t Open(Option_t* option, Bool_t parallelopen)
static void SetEnv()
virtual Int_t SysClose(Int_t fd)
virtual Int_t SysOpen(const char* pathname, Int_t flags, UInt_t mode)
virtual Int_t SysStat(Int_t fd, Long_t* id, Long64_t* size, Long_t* flags, Long_t* modtime)
public:
TXNetFile()
TXNetFile(const char* url, Option_t* option = "", const char* fTitle = "", Int_t compress = 1, Int_t netopt = -1, Bool_t parallelopen = kFALSE)
virtual ~TXNetFile()
static TClass* Class()
virtual void Close(Option_t* opt = "")
virtual void Flush()
virtual TFile::EAsyncOpenStatus GetAsyncOpenStatus()
virtual TClass* IsA() const
virtual Bool_t IsOpen() const
virtual Bool_t ReadBuffer(char* buf, Int_t len)
virtual Bool_t ReadBuffers(char* buf, Long64_t* pos, Int_t* len, Int_t nbuf)
virtual Int_t ReOpen(Option_t* mode)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
Long64_t Size()
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
virtual Bool_t WriteBuffer(const char* buffer, Int_t BufferLength)
private:
XrdClient* fClient Handle to the client object
Long64_t fSize File size
Bool_t fIsRootd Nature of remote file server
static Bool_t fgInitDone Avoid initializing more than once
static Bool_t fgRootdBC Control rootd backward compatibility
XrdOucRecMutex* fInitMtx Protects fInitDone, serializes the
TXNetFile
Authors: Alvise Dorigo, Fabrizio Furano
INFN Padova, 2003
Interfaced to the standalone client (XrdClient): G. Ganis, CERN
TXNetFile is an extension of TNetFile able to deal with new xrootd
server. Its new features are:
- Automatic server kind recognition (xrootd load balancer, xrootd
data server, old rootd)
- Backward compatibility with old rootd server (acts as an old
TNetFile)
- Fault tolerance for read/write operations (read/write timeouts
and retry)
- Internal connection timeout (tunable indipendently from the OS
one) handled by threads
- handling of redirections from server
- Single TCP physical channel for multiple TXNetFile's instances
inside the same application
So, each TXNetFile object client must send messages containing
its ID (streamid). The server, of course, will respond with
messages containing the client's ID, in order to make the client
able to recognize its message by matching its streamid with that
one contained in the server's response.
- Tunable log verbosity level (0 = nothing, 3 = dump read/write
buffers too!)
- Many parameters configurable via TEnv facility (see SetParm()
methods)
TXNetFile(const char *url, Option_t *option, const char* ftitle, Int_t compress, Int_t netopt, Bool_t parallelopen)
Create a TXNetFile object. A TXNetFile object is the same as a TNetFile
(from which the former derives) except that the protocol is extended to
support dealing with new xrootd data server or xrootd load balancer
server.
The "url" argument must be of the form
root://server1:port1[,server2:port2,...,serverN:portN]/pathfile,
Note that this means that multiple servers (>= 1) can be specified in
the url. The connection will try to connect to the first server:port
and if that does not succeed, it will try the second one, and so on
until it finds a server that will respond.
See the TNetFile documentation for the description of the other arguments.
The creation consists of internal variable settings (most important is
the client's domain), creation of a TXUrl array containing all specified
urls (a single url is serverX:portX/pathfile), trying to connect to the
servers calling Connect() method, getting a valid access to the remote
server the client is connected to using GetAccessToSrv() method,
recognizing the remote server (if an old rootd the TNetFile's Create
method will be called).
The options field of the URL can be used for the following purposes:
a. open a non-ROOT generic file
"root://server1:port1[,server2:port2,...]/pathfile?filetype=raw"
b. re-check the environment variables
"root://server1:port1[,server2:port2,...]/pathfile?checkenv"
Bool_t ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf)
Read the nbuf blocks described in arrays pos and len,
where pos[i] is the seek position of block i of length len[i].
Note that for nbuf=1, this call is equivalent to TFile::ReafBuffer
This function is overloaded by TNetFile, TWebFile, etc.
Returns kTRUE in case of failure.
Note: This is the overloading made in TXNetFile, If ReadBuffers
is supported by xrootd it will try to gt the whole list from one single
call avoiding the latency of multiple calls
void Init(Bool_t create)
Initialize the file. Makes sure that the file is really open before
calling TFile::Init. It may block.
void Flush()
Flushes un-written data.
void SetEnv()
Set the relevant environment variables
Author: Alvise Dorigo, Fabrizio Furano
Last update: root/netx:$Name: $:$Id: TXNetFile.cxx,v 1.35 2006/07/09 16:59:47 brun Exp $
Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.