89 :
TFile(url, "NET", ftitle, compress), fEndpointUrl(url)
92 Create(url, option, netopt);
101 :
TFile(url,
"NET", ftitle, compress), fEndpointUrl(url)
179 Int_t mode, uid, gid, islink;
184 sscanf(msg,
"%ld %ld %d %d %d %I64d %ld %d", &dev, &ino, &mode,
185 &uid, &gid, size, modtime, &islink);
187 sscanf(msg,
"%ld %ld %d %d %d %lld %ld %d", &dev, &ino, &mode,
188 &uid, &gid, size, modtime, &islink);
193 *
id = (dev << 24) + ino;
205 sscanf(msg,
"%ld %I64d %ld %ld",
id, size, flags, modtime);
207 sscanf(msg,
"%ld %lld %ld %ld",
id, size, flags, modtime);
270 Printf(
"Remote file: %s", &fname[1]);
299 Error(
"ReOpen",
"operation not supported by remote rootd (protocol = %d)",
333 Error(
"ReadBuffer",
"error sending kROOTD_GET command");
352 Error(
"ReadBuffer",
"error receiving buffer of length %d, got %d", len, n);
404 Int_t blockSize = 262144;
418 for(
Int_t i = 0; i < nbuf; i++) {
429 Error(
"ReadBuffers",
"error sending kROOTD_GETS command");
435 Error(
"ReadBuffers",
"error sending buffer");
448 while (actual_pos < total_len) {
449 Long64_t left = total_len - actual_pos;
450 if (left > blockSize)
458 if (n !=
Int_t(left)) {
459 Error(
"GetBuffers",
"error receiving buffer of length %d, got %d",
480 gPerfStats->FileReadEvent(
this, total_len, start);
488 Info(
"ReadBuffers",
"Couldnt use the specific implementation, calling TFile::ReadBuffers");
516 Error(
"WriteBuffer",
"error sending kROOTD_PUT command");
522 Error(
"WriteBuffer",
"error sending buffer");
588 Int_t sSize = netopt < -1 ? -netopt : 1;
590 if (url.Contains(
"root")) {
600 Error(
"TNetFile",
"can't open %d-stream connection to rootd on "
603 Error(
"TNetFile",
"can't open connection to rootd on "
612 Warning(
"ConnectServer",
"rootd does not support \"+read\" option");
631 Recv(tmpstat, tmpkind);
673 Int_t tcpwindowsize = 65535;
680 if (option[0] ==
'-') {
685 if (option[0] ==
'F' || option[0] ==
'f') {
691 if (!strcasecmp(option,
"+read")) {
705 if (!create && !recreate && !update && !read) {
715 if (netopt > tcpwindowsize)
716 tcpwindowsize = netopt;
721 ConnectServer(&stat, &kind, netopt, tcpwindowsize, forceOpen, forceRead);
722 if (
gDebug > 2)
Info(
"Create",
"got from host %d %d", stat, kind);
736 if (update && stat > 1) {
815 :
TSystem(
"-root",
"Net file Helper System")
837 :
TSystem(
"-root",
"Net file Helper System")
933 "remote daemon does not support 'system' functionality");
1013 Info(
"OpenDirectory",
"a directory is already open: close it first");
1040 if (dirp !=
fDirp) {
1041 Error(
"FreeDirectory",
"invalid directory pointer (should never happen)");
1064 if (dirp !=
fDirp) {
1065 Error(
"GetDirEntry",
"invalid directory pointer (should never happen)");
1131 if (!checkstd)
return kFALSE;
1135 if (path && strlen(path)) {
1153 Info(
"ConsistentWith",
"fUser:'%s' (%s), fHost:'%s' (%s), fPort:%d (%d)",
1161 return (checkstd && checknet);
1178 Warning(
"Unlink",
"functionality not implemented - ignored (path: %s)", path);
const char * GetHost() const
ClassImp(TNetFile) ClassImp(TNetSystem) TNetFile
Create a TNetFile object.
const char * GetDirEntry(void *dirp=0)
Get directory entry via rootd. Returns 0 in case no more entries.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Int_t GetPathInfo(const char *path, FileStat_t &buf, Bool_t print=kFALSE)
Get info about a file.
Bool_t AccessPathName(const char *path, EAccessMode mode)
Returns FALSE if one can access a file using the specified access mode.
double read(const std::string &file_name)
reading
virtual void ConnectServer(Int_t *stat, EMessageTypes *kind, Int_t netopt, Int_t tcpwindowsize, Bool_t forceOpen, Bool_t forceRead)
Connect to remote rootd server.
Int_t SysClose(Int_t fd)
Close currently open file.
virtual Bool_t IsPathLocal(const char *path)
Returns TRUE if the url in 'path' points to the local file system.
Long64_t fBytesWrite
Number of bytes written to this file.
Int_t GetRemoteProtocol() const
R__EXTERN const char * gRootdErrStr[]
static std::atomic< Long64_t > fgBytesRead
Number of bytes read by all TFile objects.
virtual Int_t ReOpen(Option_t *mode)
Reopen a file with a different access mode.
virtual Int_t Send(const TMessage &mess)
Send a TMessage object.
virtual void SetOffset(Long64_t offset, ERelativeTo pos=kBeg)
Set position from where to start reading.
This class represents a WWW compatible URL.
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
Int_t MakeDirectory(const char *dir, Bool_t print=kFALSE) const
Make a remote directory.
virtual Int_t Recv(TMessage *&mess)
Receive a TMessage object.
virtual void SetName(const char *name)
Change (i.e.
const char * GetProtocol() const
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
static void SetFileReadCalls(Int_t readcalls=0)
Bool_t Matches(const char *url)
Return kTRUE if 'url' matches the coordinates of this file.
const char * GetUser() const
virtual int MakeDirectory(const char *name)
Make a directory.
void ToUpper()
Change string to upper case.
const char * GetHost() const
void Flush()
Flush file to disk.
TNetSystem(const TNetSystem &)
Int_t WriteBufferViaCache(const char *buf, Int_t len)
Write buffer via cache.
Bool_t OpenDirectory(const char *name, Bool_t print=kFALSE)
Open a directory via rootd.
void Create(const char *url, TSocket *sock=0)
Create a TNetSystem object.
R__EXTERN TApplication * gApplication
virtual void IgnoreInterrupt(Bool_t ignore=kTRUE)
If ignore is true ignore the interrupt signal, else restore previous behaviour.
Int_t fReadCalls
Number of read calls ( not counting the cache calls )
const char * GetOptions() const
int Unlink(const char *path)
Remove a path.
TString & Insert(Ssiz_t pos, const char *s)
Int_t GetPathInfo(const char *path, FileStat_t &buf)
Get info about a file.
TSignalHandler * GetSignalHandler() const
Bool_t R_ISREG(Int_t mode)
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
static Int_t GetErrno()
Static function returning system error number.
static void SetFileBytesWritten(Long64_t bytes=0)
const char * Data() const
virtual Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Send a raw buffer of specified length.
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
virtual int Unlink(const char *name)
Unlink, i.e. remove, a file.
static Long64_t GetFileBytesRead()
Static function returning the total number of bytes read from all files.
static Long64_t GetFileBytesWritten()
Static function returning the total number of bytes written to all files.
Int_t ReOpen(Option_t *mode)
Reopen a file with a different access mode, like from READ to UPDATE or from NEW, CREATE...
static TSocket * CreateAuthSocket(const char *user, const char *host, Int_t port, Int_t size=0, Int_t tcpwindowsize=-1, TSocket *s=0, Int_t *err=0)
Creates a socket or a parallel socket and authenticates to the remote server specified in 'url' on re...
virtual Bool_t IsAuthenticated() const
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual Bool_t ConsistentWith(const char *path, void *dirptr=0)
Check consistency of this helper with the one required by 'path' or 'dirptr'.
void PrintError(const char *where, Int_t err)
Print error string depending on error code.
Int_t SysStat(Int_t fd, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime)
Return file stat information.
R__EXTERN TSystem * gSystem
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
const char * GetHostFQDN() const
Return fully qualified domain name of url host.
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
TSocket * GetSocket() const
char * Form(const char *fmt,...)
static std::atomic< Long64_t > fgBytesWrite
Number of bytes written by all TFile objects.
static std::atomic< Int_t > fgReadCalls
Number of bytes read from all TFile objects.
void * OpenDirectory(const char *name)
Open a directory via rfiod.
Int_t MakeDirectory(const char *name)
Make a directory via rootd.
const char * GetDirEntry(Bool_t print=kFALSE)
Get directory entry via rootd.
Int_t Recv(Int_t &status, EMessageTypes &kind)
Return status from rootd server and message kind.
static Int_t GetFileReadCalls()
Static function returning the total number of read calls from all files.
void HandleDelayedSignal()
virtual void Init(Bool_t create)
Initialize a TFile object.
void Seek(Long64_t offset, ERelativeTo pos=kBeg)
Set position from where to start reading.
Bool_t WriteBuffer(const char *buf, Int_t len)
Write specified byte range to remote file via rootd daemon.
virtual void FreeDirectory(void *dirp)
Free a directory.
Int_t ReadBufferViaCache(char *buf, Int_t len)
Read buffer via cache.
Bool_t fWritable
True if directory is writable.
TString ToLower(const TString &s)
Return a lower-case version of str.
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
Bool_t ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf)
Read a list of buffers given in pos[] and len[] and return it in a single buffer. ...
Int_t SysOpen(const char *pathname, Int_t flags, UInt_t mode)
Open a remote file. Requires fOption to be set correctly.
virtual void Create(const char *url, Option_t *option, Int_t netopt)
Create a NetFile object.
const char * GetUrl() const
void Close(Option_t *option="")
Close remote file.
Bool_t IsOpen() const
Retruns kTRUE if file is open, kFALSE otherwise.
The TTimeStamp encapsulates seconds and ns since EPOCH.
TString fOption
File options.
virtual ~TNetFile()
TNetFile dtor. Send close message and close socket.
Int_t Close()
Close ftp connection.
Bool_t ConsistentWith(const char *path, void *dirptr)
Check consistency of this helper with the one required by 'path' or 'dirptr'.
Bool_t FlushWriteCache()
Flush the write cache if active.
TSecContext * GetSecContext() const
Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists, Bool_t print=kFALSE)
Returns kFALSE if one can access a file using the specified access mode.
Bool_t R_ISDIR(Int_t mode)
Bool_t ReadBuffer(char *buf, Int_t len)
Read specified byte range from remote file via rootd daemon.
virtual Bool_t ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf)
Read the nbuf blocks described in arrays pos and len.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual ~TNetSystem()
Destructor.
void Print(Option_t *option) const
Print some info about the net file.
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
void FreeDirectory(Bool_t print=kFALSE)
Free a remotely open directory via rootd.
Long64_t fArchiveOffset
!Offset at which file starts in archive
static void ResetErrno()
Static function resetting system error number.
void Init(Bool_t create)
Initialize a TNetFile object.
Long64_t fOffset
!Seek offset cache
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
static void SetFileBytesRead(Long64_t bytes=0)
Abstract base class defining a generic interface to the underlying Operating System.
virtual Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Receive a raw buffer of specified length bytes.
const char * GetUser() const
void InitRemoteEntity(const char *url)
Parse and save coordinates of the remote entity (user, host, port, ...)
void FreeDirectory(void *dirp=0)
Free directory via rootd.
Long64_t fBytesRead
Number of bytes read from this file.
const char * GetFile() const
virtual void Close(Option_t *option="")
Close a file.
virtual Bool_t Matches(const char *name)
Return kTRUE if 'url' matches the coordinates of this file.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.