81 :
TFile(url,
"NET", ftitle, compress), fEndpointUrl(url)
84 Create(url, option, netopt);
93 :
TFile(url,
"NET", ftitle, compress), fEndpointUrl(url)
171 Int_t mode, uid, gid, islink;
176 sscanf(msg,
"%ld %ld %d %d %d %I64d %ld %d", &dev, &ino, &mode,
177 &uid, &gid, size, modtime, &islink);
179 sscanf(msg,
"%ld %ld %d %d %d %lld %ld %d", &dev, &ino, &mode,
180 &uid, &gid, size, modtime, &islink);
185 *
id = (dev << 24) + ino;
197 sscanf(msg,
"%ld %I64d %ld %ld",
id, size, flags, modtime);
199 sscanf(msg,
"%ld %lld %ld %ld",
id, size, flags, modtime);
262 Printf(
"Remote file: %s", &fname[1]);
291 Error(
"ReOpen",
"operation not supported by remote rootd (protocol = %d)",
325 Error(
"ReadBuffer",
"error sending kROOTD_GET command");
344 Error(
"ReadBuffer",
"error receiving buffer of length %d, got %d", len,
n);
396 Int_t blockSize = 262144;
410 for(
Int_t i = 0; i < nbuf; i++) {
421 Error(
"ReadBuffers",
"error sending kROOTD_GETS command");
427 Error(
"ReadBuffers",
"error sending buffer");
440 while (actual_pos < total_len) {
441 Long64_t left = total_len - actual_pos;
442 if (left > blockSize)
451 Error(
"GetBuffers",
"error receiving buffer of length %d, got %d",
472 gPerfStats->FileReadEvent(
this, total_len, start);
480 Info(
"ReadBuffers",
"Couldnt use the specific implementation, calling TFile::ReadBuffers");
508 Error(
"WriteBuffer",
"error sending kROOTD_PUT command");
514 Error(
"WriteBuffer",
"error sending buffer");
580 Int_t sSize = netopt < -1 ? -netopt : 1;
592 Error(
"TNetFile",
"can't open %d-stream connection to rootd on "
595 Error(
"TNetFile",
"can't open connection to rootd on "
604 Warning(
"ConnectServer",
"rootd does not support \"+read\" option");
623 Recv(tmpstat, tmpkind);
664 Int_t tcpwindowsize = 65535;
671 if (option[0] ==
'-') {
676 if (option[0] ==
'F' || option[0] ==
'f') {
682 if (!strcasecmp(option,
"+read")) {
696 if (!create && !recreate && !
update && !read) {
706 if (netopt > tcpwindowsize)
707 tcpwindowsize = netopt;
712 ConnectServer(&stat, &kind, netopt, tcpwindowsize, forceOpen, forceRead);
713 if (
gDebug > 2)
Info(
"Create",
"got from host %d %d", stat, kind);
806 :
TSystem(
"-root",
"Net file Helper System")
828 :
TSystem(
"-root",
"Net file Helper System")
924 "remote daemon does not support 'system' functionality");
1004 Info(
"OpenDirectory",
"a directory is already open: close it first");
1031 if (dirp !=
fDirp) {
1032 Error(
"FreeDirectory",
"invalid directory pointer (should never happen)");
1055 if (dirp !=
fDirp) {
1056 Error(
"GetDirEntry",
"invalid directory pointer (should never happen)");
1122 if (!checkstd)
return kFALSE;
1126 if (path && strlen(path)) {
1144 Info(
"ConsistentWith",
"fUser:'%s' (%s), fHost:'%s' (%s), fPort:%d (%d)",
1152 return (checkstd && checknet);
1169 Warning(
"Unlink",
"functionality not implemented - ignored (path: %s)", path);
R__EXTERN const char * gRootdErrStr[]
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
R__EXTERN TApplication * gApplication
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
TString ToLower(const TString &s)
Return a lower-case version of str.
char * Form(const char *fmt,...)
void Printf(const char *fmt,...)
Bool_t R_ISREG(Int_t mode)
Bool_t R_ISDIR(Int_t mode)
R__EXTERN TSystem * gSystem
TSignalHandler * GetSignalHandler() const
Bool_t fWritable
True if directory is writable.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Int_t MakeDirectory(const char *dir, Bool_t print=kFALSE) const
Make a remote directory.
void FreeDirectory(Bool_t print=kFALSE)
Free a remotely open directory via rootd.
Int_t GetPathInfo(const char *path, FileStat_t &buf, Bool_t print=kFALSE)
Get info about a file.
Bool_t OpenDirectory(const char *name, Bool_t print=kFALSE)
Open a directory via rootd.
TSocket * GetSocket() const
const char * GetDirEntry(Bool_t print=kFALSE)
Get directory entry via rootd.
Int_t Close()
Close ftp connection.
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.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
static std::atomic< Long64_t > fgBytesRead
Number of bytes read by all TFile objects.
Int_t fReadCalls
Number of read calls ( not counting the cache calls )
static void SetFileBytesWritten(Long64_t bytes=0)
Long64_t fBytesRead
Number of bytes read from this file.
virtual Int_t ReOpen(Option_t *mode)
Reopen a file with a different access mode.
virtual Bool_t Matches(const char *name)
Return kTRUE if 'url' matches the coordinates of this file.
static Long64_t GetFileBytesWritten()
Static function returning the total number of bytes written to all files.
static void SetFileBytesRead(Long64_t bytes=0)
static void SetFileReadCalls(Int_t readcalls=0)
Int_t WriteBufferViaCache(const char *buf, Int_t len)
Write buffer via cache.
static Long64_t GetFileBytesRead()
Static function returning the total number of bytes read from all files.
Int_t ReadBufferViaCache(char *buf, Int_t len)
Read buffer via cache.
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.
Long64_t fArchiveOffset
!Offset at which file starts in archive
virtual void Init(Bool_t create)
Initialize a TFile object.
TString fOption
File options.
Bool_t FlushWriteCache()
Flush the write cache if active.
Long64_t fBytesWrite
Number of bytes written to this file.
virtual void SetOffset(Long64_t offset, ERelativeTo pos=kBeg)
Set position from where to start reading.
Long64_t fOffset
!Seek offset cache
static std::atomic< Long64_t > fgBytesWrite
Number of bytes written by all TFile objects.
void Close(Option_t *option="") override
Close a file.
static std::atomic< Int_t > fgReadCalls
Number of bytes read from all TFile objects.
static Int_t GetFileReadCalls()
Static function returning the total number of read calls from all files.
virtual void SetName(const char *name)
Set the name of the TNamed.
Int_t SysOpen(const char *pathname, Int_t flags, UInt_t mode)
Open a remote file. Requires fOption to be set correctly.
void Seek(Long64_t offset, ERelativeTo pos=kBeg)
Set position from where to start reading.
void Print(Option_t *option) const
Print some info about the net file.
Int_t SysStat(Int_t fd, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime)
Return file stat information.
virtual void Create(const char *url, Option_t *option, Int_t netopt)
Create a NetFile object.
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 Recv(Int_t &status, EMessageTypes &kind)
Return status from rootd server and message kind.
Bool_t IsOpen() const
Retruns kTRUE if file is open, kFALSE otherwise.
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.
Bool_t Matches(const char *url)
Return kTRUE if 'url' matches the coordinates of this file.
Int_t SysClose(Int_t fd)
Close currently open file.
void PrintError(const char *where, Int_t err)
Print error string depending on error code.
Bool_t ReadBuffer(char *buf, Int_t len)
Read specified byte range from remote file via rootd daemon.
void Init(Bool_t create)
Initialize a TNetFile object.
Bool_t WriteBuffer(const char *buf, Int_t len)
Write specified byte range to remote file via rootd daemon.
void Close(Option_t *option="")
Close remote file.
virtual ~TNetFile()
TNetFile dtor. Send close message and close socket.
void Flush()
Flush file to disk.
Int_t ReOpen(Option_t *mode)
Reopen a file with a different access mode, like from READ to UPDATE or from NEW, CREATE,...
const char * GetDirEntry(void *dirp=0)
Get directory entry via rootd. Returns 0 in case no more entries.
void InitRemoteEntity(const char *url)
Parse and save coordinates of the remote entity (user, host, port, ...)
Int_t MakeDirectory(const char *name)
Make a directory via rootd.
void Create(const char *url, TSocket *sock=0)
Create a TNetSystem object.
void FreeDirectory(void *dirp=0)
Free directory via rootd.
Bool_t ConsistentWith(const char *path, void *dirptr)
Check consistency of this helper with the one required by 'path' or 'dirptr'.
Bool_t AccessPathName(const char *path, EAccessMode mode)
Returns FALSE if one can access a file using the specified access mode.
Int_t GetPathInfo(const char *path, FileStat_t &buf)
Get info about a file.
virtual ~TNetSystem()
Destructor.
TNetSystem(const TNetSystem &)
int Unlink(const char *path)
Remove a path.
void * OpenDirectory(const char *name)
Open a directory and return an opaque pointer to a dir structure.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
const char * GetHost() const
const char * GetUser() const
void HandleDelayedSignal()
virtual Int_t Recv(TMessage *&mess)
Receive a TMessage object.
Int_t GetRemoteProtocol() const
virtual Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Receive a raw buffer of specified length bytes.
TSecContext * GetSecContext() const
virtual Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Send a raw buffer of specified length.
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...
const char * GetUrl() const
virtual Int_t Send(const TMessage &mess)
Send a TMessage object.
virtual Bool_t IsAuthenticated() const
TString & Insert(Ssiz_t pos, const char *s)
const char * Data() const
void ToUpper()
Change string to upper case.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Abstract base class defining a generic interface to the underlying Operating System.
virtual void IgnoreInterrupt(Bool_t ignore=kTRUE)
If ignore is true ignore the interrupt signal, else restore previous behaviour.
static void ResetErrno()
Static function resetting system error number.
static Int_t GetErrno()
Static function returning system error number.
virtual void FreeDirectory(void *dirp)
Free a directory.
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
virtual Bool_t IsPathLocal(const char *path)
Returns TRUE if the url in 'path' points to the local file system.
virtual int MakeDirectory(const char *name)
Make a directory.
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.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
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.
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
virtual Bool_t ConsistentWith(const char *path, void *dirptr=nullptr)
Check consistency of this helper with the one required by 'path' or 'dirptr'.
The TTimeStamp encapsulates seconds and ns since EPOCH.
This class represents a WWW compatible URL.
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
const char * GetFile() const
const char * GetUser() const
const char * GetHost() const
const char * GetHostFQDN() const
Return fully qualified domain name of url host.
const char * GetOptions() const
const char * GetProtocol() const