Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TDCacheFile.cxx
Go to the documentation of this file.
1// @(#)root/dcache:$Id$
2// Author: Grzegorz Mazur 20/01/2002
3// Modified: William Tanenbaum 01/12/2003
4// Modified: Tigran Mkrtchyan 29/06/2004
5// Modified: Tigran Mkrtchyan 06/07/2007
6
7/*************************************************************************
8 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
9 * All rights reserved. *
10 * *
11 * For the licensing terms see $ROOTSYS/LICENSE. *
12 * For the list of contributors see $ROOTSYS/README/CREDITS. *
13 *************************************************************************/
14
15/**
16\class TDCacheFile
17\ingroup IO
18A TDCacheFile is like a normal TFile except that it may read and
19write its data via a dCache server (for more on the dCache daemon
20see http://www-dcache.desy.de/. Given a path which doesn't belong
21to the dCache managed filesystem, it falls back to the ordinary
22TFile behaviour.
23*/
24
25#include "TDCacheFile.h"
26#include "TError.h"
27#include "TSystem.h"
28#include "TROOT.h"
29
30#include <cstdlib>
31#include <cerrno>
32#include <sys/stat.h>
33#include <sys/types.h>
34
35#include <dcap.h>
36#ifndef R__WIN32
37#include <unistd.h>
38#if defined(R__SUN) || defined(R__HPUX) || \
39 defined(R__AIX) || defined(R__LINUX) || defined(R__SOLARIS) || \
40 defined(R__HIUX) || defined(R__FBSD) || defined(R__MACOSX) || \
41 defined(R__HURD) || defined(R__OBSD)
42#define HAS_DIRENT
43#endif
44#endif
45
46#ifdef HAS_DIRENT
47#include <dirent.h>
48#endif
49
50static const char* const DCACHE_PREFIX = "dcache:";
51static const size_t DCACHE_PREFIX_LEN = strlen(DCACHE_PREFIX);
52static const char* const DCAP_PREFIX = "dcap:";
53static const size_t DCAP_PREFIX_LEN = strlen(DCAP_PREFIX);
54
55
56
57////////////////////////////////////////////////////////////////////////////////
58/// Create a dCache file object.
59///
60/// A dCache file is the same as a TFile
61/// except that it is being accessed via a dCache server. The url
62/// argument must be of the form: `dcache:/pnfs/<path>/<file>.root` or
63/// `dcap://<nodename.org>/<path>/<file>.root`. If the file specified in the
64/// URL does not exist, is not accessable or can not be created the kZombie
65/// bit will be set in the TDCacheFile object. Use IsZombie() to see if the
66/// file is accessable. For a description of the option and other arguments
67/// see the TFile ctor. The preferred interface to this constructor is
68/// via TFile::Open().
69
71 const char *ftitle, Int_t compress):
72 TFile(path, "NET", ftitle, compress)
73{
75 path = pathString.Data();
76
80
81 if (fOption == "NEW")
82 fOption = "CREATE";
83
84 Bool_t create = (fOption == "CREATE") ? kTRUE : kFALSE;
85 Bool_t recreate = (fOption == "RECREATE") ? kTRUE : kFALSE;
86 Bool_t update = (fOption == "UPDATE") ? kTRUE : kFALSE;
87 Bool_t read = (fOption == "READ") ? kTRUE : kFALSE;
88 if (!create && !recreate && !update && !read) {
89 read = kTRUE;
90 fOption = "READ";
91 }
92
95 const char *fname;
96 const char *fnameWithPrefix;
97
98 if (!strncmp(path, DCAP_PREFIX, DCAP_PREFIX_LEN)) {
99 fnameWithPrefix = fname = path;
100 } else {
101 // Metadata provided by PNFS
102 char *tname;
103 if ((tname = gSystem->ExpandPathName(path))) {
104 stmp = tname;
106 stmp2 += tname;
107 delete [] tname;
108 fname = stmp;
110 } else {
111 Error("TDCacheFile", "error expanding path %s", path);
112 goto zombie;
113 }
114 }
115
116 if (recreate) {
120 create = kTRUE;
121 fOption = "CREATE";
122 }
124 Error("TDCacheFile", "file %s already exists", fname);
125 goto zombie;
126 }
127 if (update) {
129 update = kFALSE;
130 create = kTRUE;
131 }
133 Error("TDCacheFile", "no write permission, could not open file %s", fname);
134 goto zombie;
135 }
136 }
137
138 // Connect to file system stream
140
141 if (create || update) {
142#ifndef WIN32
143 fD = SysOpen(fname, O_RDWR | O_CREAT, 0644);
144#else
146#endif
147 if (fD == -1) {
148 SysError("TDCacheFile", "file %s can not be opened", fname);
149 goto zombie;
150 }
152 } else {
153#ifndef WIN32
154 fD = SysOpen(fname, O_RDONLY, 0644);
155#else
157#endif
158 if (fD == -1) {
160 Error("TDCacheFile", "file %s does not exist", fname);
161 goto zombie;
162 }
164 Error("TDCacheFile", "no read permission, could not open file %s", fname);
165 goto zombie;
166 }
167 SysError("TDCacheFile", "file %s can not be opened for reading", fname);
168 goto zombie;
169 }
171 }
172
173 // use 128K ( default ) read-ahead buffer to get file header,
174 // the buffer size can be overriden by env var "DCACHE_RA_BUFFER",
175 // vector read are not affected by read-ahead buffer
176 if (read) {
178 const char *DCACHE_RA_BUFFER = gSystem->Getenv("DCACHE_RA_BUFFER");
179 if (DCACHE_RA_BUFFER) {
180 int ra_buffer = atoi(DCACHE_RA_BUFFER);
182 }
184 } else {
186 }
187
188 Init(create);
189
190 return;
191
192zombie:
193 // error in file opening occured, make this object a zombie
194 MakeZombie();
196}
197
198////////////////////////////////////////////////////////////////////////////////
199/// Close and cleanup dCache file.
200
205
206////////////////////////////////////////////////////////////////////////////////
207/// Read specified byte range from remote file via dCache daemon.
208/// Returns kTRUE in case of error.
209
211{
212 Int_t st;
213 if ((st = ReadBufferViaCache(buf, len))) {
214 if (st == 2)
215 return kTRUE;
216 return kFALSE;
217 }
218
219 return TFile::ReadBuffer(buf, len);
220}
221
222////////////////////////////////////////////////////////////////////////////////
223/// Read specified byte range from remote file via dCache daemon.
224/// Returns kTRUE in case of error.
225
227{
228 SetOffset(pos);
229 Int_t st;
230 if ((st = ReadBufferViaCache(buf, len))) {
231 if (st == 2)
232 return kTRUE;
233 return kFALSE;
234 }
235
236 return TFile::ReadBuffer(buf, pos, len);
237}
238
239////////////////////////////////////////////////////////////////////////////////
240/// Read the nbuf blocks described in arrays pos and len,
241/// where pos[i] is the seek position of block i of length len[i].
242/// Note that for nbuf=1, this call is equivalent to TFile::ReafBuffer.
243/// This function is overloaded by TNetFile, TWebFile, etc.
244/// Returns kTRUE in case of failure.
245
247{
248#ifdef _IOVEC2_
249
250 iovec2 *vector;
251
252 vector = (iovec2 *)malloc(sizeof(iovec2)*nbuf);
253
254 Int_t total_len = 0;
255 for (Int_t i = 0; i < nbuf; i++) {
256 vector[i].buf = &buf[total_len];
257 vector[i].offset = pos[i] + fArchiveOffset;
258 vector[i].len = len[i];
259 total_len += len[i];
260 }
261
262 Int_t rc = dc_readv2(fD, vector, nbuf);
263 free(vector);
264
265 if (rc == 0) {
268 return kFALSE;
269 }
270
271#endif
272
273 // if we failed to get with dc_readv2 (old server), try to loop over
274
275 Int_t k = 0;
278 fCacheRead = 0;
279
280 Long64_t low = pos[0];
281 Long64_t high = pos[nbuf-1] + len[nbuf-1] - pos[0];
282
283 Long64_t total = 0;
284 for(Int_t j=0; j < nbuf; j++) {
285 total += len[j];
286 }
287
288 if ( total && high / total < 10 ) {
289
290 char *temp = new char[high];
291 Seek(low);
292 result = ReadBuffer(temp,high);
293
294 if (result==0) {
295 for (Int_t i = 0; i < nbuf; i++) {
296 memcpy(&buf[k], &(temp[pos[i]-pos[0]]), len[i]);
297 k += len[i];
298 }
299 }
300
301 delete [] temp;
302
303 } else {
304
305 for (Int_t i = 0; i < nbuf; i++) {
306 Seek(pos[i]);
307 result = ReadBuffer(&buf[k], len[i]);
308 if (result) break;
309 k += len[i];
310 }
311
312 }
313
314 fCacheRead = old;
315 return result;
316}
317
318////////////////////////////////////////////////////////////////////////////////
319/// Write specified byte range to remote file via dCache daemon.
320/// Returns kTRUE in case of error.
321
323{
324 if (!IsOpen() || !fWritable) return kTRUE;
325
326 Int_t st;
327 if ((st = WriteBufferViaCache(buf, len))) {
328 if (st == 2)
329 return kTRUE;
330 return kFALSE;
331 }
332
333 return TFile::WriteBuffer(buf, len);
334}
335
336////////////////////////////////////////////////////////////////////////////////
337/// Stage() returns kTRUE on success and kFALSE on failure.
338
339Bool_t TDCacheFile::Stage(const char *path, UInt_t after, const char *location)
340{
342 path = pathString.Data();
343
344 dc_errno = 0;
345
346 if (dc_stage(path, after, location) == 0)
347 return kTRUE;
348
349 if (dc_errno != 0)
351
352 return kFALSE;
353}
354
355////////////////////////////////////////////////////////////////////////////////
356/// CheckFile() returns kTRUE on success and kFALSE on failure. In
357/// case the file exists but is not cached, CheckFile() returns
358/// kFALSE and errno is set to EAGAIN.
359
360Bool_t TDCacheFile::CheckFile(const char *path, const char *location)
361{
363 path = pathString.Data();
364
365 dc_errno = 0;
366
367 if (dc_check(path, location) == 0)
368 return kTRUE;
369
370 if (dc_errno != 0)
372
373 return kFALSE;
374}
375
376////////////////////////////////////////////////////////////////////////////////
377/// Set file open timeout.
378
383
384////////////////////////////////////////////////////////////////////////////////
385/// Set on error handler.
386
391
392////////////////////////////////////////////////////////////////////////////////
393/// Set reply host name.
394
395void TDCacheFile::SetReplyHostName(const char *host_name)
396{
397 dc_setReplyHostName((char*)host_name);
398}
399
400////////////////////////////////////////////////////////////////////////////////
401/// Return dCache version string.
402
404{
405 return getDcapVersion();
406}
407
408////////////////////////////////////////////////////////////////////////////////
409/// Interface to system open. All arguments like in POSIX open.
410
412{
413 // often there is a filewall on front of storage system.
414 // let clients connect to the data servers
415 // if it's an old dCache version, pool will try to connect to the client
416 // (if it's fine with firewall)
417
419
420 dc_errno = 0;
421
422 Int_t rc = dc_open(pathname, flags, (Int_t) mode);
423
424 if (rc < 0) {
425 if (dc_errno != 0)
427 }
428
429 return rc;
430}
431
432////////////////////////////////////////////////////////////////////////////////
433/// Interface to system close. All arguments like in POSIX close.
434
436{
437 dc_errno = 0;
438
439 Int_t rc = dc_close(fd);
440
441 if (rc < 0) {
442 if (dc_errno != 0)
444 }
445
446 return rc;
447}
448
449////////////////////////////////////////////////////////////////////////////////
450/// Interface to system read. All arguments like in POSIX read.
451
453{
454 dc_errno = 0;
455
456 Int_t rc = dc_read(fd, buf, len);
457
458 if (rc < 0) {
459 if (dc_errno != 0)
461 }
462
463 return rc;
464}
465
466////////////////////////////////////////////////////////////////////////////////
467/// Interface to system write. All arguments like in POSIX write.
468
470{
471 dc_errno = 0;
472
473 Int_t rc = dc_write(fd, (char *)buf, len);
474
475 if (rc < 0) {
476 if (dc_errno != 0)
478 }
479
480 return rc;
481}
482
483////////////////////////////////////////////////////////////////////////////////
484/// Interface to system seek. All arguments like in POSIX lseek.
485
487{
488 dc_errno = 0;
489
491
492 if (rc < 0) {
493 if (dc_errno != 0)
495 }
496
497 return rc;
498}
499
500////////////////////////////////////////////////////////////////////////////////
501/// Interface to system sync. All arguments like in POSIX fsync.
502/// dCache always keep it's files sync'ed, so there's no need to
503/// sync() them manually.
504
506{
507 Int_t rc;
508 dc_errno = 0;
509
510 rc = dc_fsync(fd);
511 if (rc < 0) {
512 if (dc_errno != 0)
514 }
515
516 return rc;
517}
518
519////////////////////////////////////////////////////////////////////////////////
520/// Get info about a file: id, size, flags, modification time.
521///
522/// \param[in] fd ignored
523/// \param[in] id (statbuf.st_dev << 24) + statbuf.st_ino
524/// \param[in] size The file size
525/// \param[in] flags File type: 0 is regular file, bit 0 set executable, bit 1 set directory, bit 2 set special file (socket, fifo, pipe, etc.)
526/// \param[in] modtime Modification time.
527/// The function returns 0 in case of success and 1 if the file could
528/// not be stat'ed.
529
531 Long_t *flags, Long_t *modtime)
532{
533 // If in read mode, uses the cached file status, if available, to avoid
534 // costly dc_stat() call.
535
536 struct stat64 & statbuf = fStatBuffer; // reference the cache
537
538 if (fOption != "READ" || !fStatCached) {
539 // We are not in read mode, or the file status information is not yet
540 // in the cache. Update or read the status information with dc_stat().
541
542 const char *path = GetName();
544 path = pathString.Data();
545
546 if (path && (dc_stat64(path, &statbuf) >= 0)) {
548 }
549 }
550
551 if (fStatCached) {
552 if (id)
553 *id = (statbuf.st_dev << 24) + statbuf.st_ino;
554 if (size)
555 *size = statbuf.st_size;
556 if (modtime)
557 *modtime = statbuf.st_mtime;
558 if (flags) {
559 *flags = 0;
560 if (statbuf.st_mode & ((S_IEXEC)|(S_IEXEC>>3)|(S_IEXEC>>6)))
561 *flags |= 1;
562 if ((statbuf.st_mode & S_IFMT) == S_IFDIR)
563 *flags |= 2;
564 if ((statbuf.st_mode & S_IFMT) != S_IFREG &&
565 (statbuf.st_mode & S_IFMT) != S_IFDIR)
566 *flags |= 4;
567 }
568 return 0;
569 }
570 return 1;
571}
572
573////////////////////////////////////////////////////////////////////////////////
574/// Method resetting the dc_errno and errno.
575
577{
578 dc_errno = 0;
580}
581
582////////////////////////////////////////////////////////////////////////////////
583/// Transform the input path into a path usuable by the dcap C library,
584/// i.e either \a dcap://nodename.org/where/filename.root or
585/// \a /pnfs/where/filename.root
586
588{
589 // eat all 'dcache:' prefixes
590 while (!strncmp(path, DCACHE_PREFIX, DCACHE_PREFIX_LEN)) {
591 path += DCACHE_PREFIX_LEN;
592 }
593
594 TUrl url(path);
595 TString pathString(url.GetUrl());
596
597 // convert file://path url and dcap:///path to /path
598 if(!strncmp(url.GetProtocol(), "file", 4) || !strcmp(url.GetHost(),"")){
599 pathString = url.GetFile();
600 }
601
602 return pathString;
603}
604
605
606////////////////////////////////////////////////////////////////////////////////
607/// Create helper class that allows directory access via dCache.
608
609TDCacheSystem::TDCacheSystem() : TSystem("-DCache", "DCache Helper System")
610{
611 // name must start with '-' to bypass the TSystem singleton check
612 SetName("DCache");
613
614 fDirp = 0;
615}
616
617////////////////////////////////////////////////////////////////////////////////
618/// Create a directory.
619
620int TDCacheSystem::MakeDirectory(const char *path)
621{
622 Int_t rc;
623 dc_errno = 0;
625 path = pathString.Data();
626
627 rc = dc_mkdir(path, 0755);
628 if (rc < 0) {
629 if (dc_errno != 0)
631 }
632
633 return rc;
634}
635
636////////////////////////////////////////////////////////////////////////////////
637/// Open a directory.
638
639void *TDCacheSystem::OpenDirectory(const char *path)
640{
641 dc_errno = 0;
643 path = pathString.Data();
644
645 fDirp = dc_opendir(path);
646 if (fDirp == 0) {
647 if (dc_errno != 0)
649 }
650
651 return fDirp;
652}
653
654////////////////////////////////////////////////////////////////////////////////
655/// Close a directory.
656
658{
659 Int_t rc;
660 dc_errno = 0;
661
662 rc = dc_closedir((DIR *)dirp);
663 if (rc < 0) {
664 if (dc_errno != 0)
666 }
667
668 fDirp = 0;
669 return;
670}
671
672////////////////////////////////////////////////////////////////////////////////
673/// Get a directory entry.
674
676{
677 struct dirent *ent;
678 dc_errno = 0;
679
680 ent = dc_readdir((DIR *)dirp);
681 if (ent == 0) {
682 if (dc_errno != 0)
684 }
685
686 return !ent ? 0 : ent->d_name;
687}
688
689////////////////////////////////////////////////////////////////////////////////
690/// Returns FALSE if one can access a file using the specified access mode.
691/// Mode is the same as for the Unix access(2) function.
692/// Attention, bizarre convention of return value!!
693
695{
697 path = pathString.Data();
698
699 return dc_access(path, mode);
700}
701
702////////////////////////////////////////////////////////////////////////////////
703/// Get info about a file. Info is returned in the form of a FileStat_t
704/// structure (see TSystem.h).
705/// The function returns 0 in case of success and 1 if the file could
706/// not be stat'ed.
707
708int TDCacheSystem::GetPathInfo(const char *path, FileStat_t &buf)
709{
711 path = pathString.Data();
712
713 struct stat64 sbuf;
714
715 if (path && (dc_stat64(path, &sbuf) >= 0)) {
716
717 buf.fDev = sbuf.st_dev;
718 buf.fIno = sbuf.st_ino;
719 buf.fMode = sbuf.st_mode;
720 buf.fUid = sbuf.st_uid;
721 buf.fGid = sbuf.st_gid;
722 buf.fSize = sbuf.st_size;
723 buf.fMtime = sbuf.st_mtime;
724 buf.fIsLink = kFALSE;
725
726 return 0;
727 }
728 return 1;
729}
#define a(i)
Definition RSha256.hxx:99
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
Definition RtypesCore.h:68
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:83
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
static const char *const DCACHE_PREFIX
static const size_t DCAP_PREFIX_LEN
static const size_t DCACHE_PREFIX_LEN
static const char *const DCAP_PREFIX
#define RAHEAD_BUFFER_SIZE
Definition TDCacheFile.h:23
#define gDirectory
Definition TDirectory.h:385
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:208
void SysError(const char *location, const char *msgfmt,...)
Use this function in case a system (OS or GUI) related error occurred.
Definition TError.cxx:219
static unsigned int total
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char mode
#define gROOT
Definition TROOT.h:411
EAccessMode
Definition TSystem.h:51
@ kFileExists
Definition TSystem.h:52
@ kReadPermission
Definition TSystem.h:55
@ kWritePermission
Definition TSystem.h:54
R__EXTERN TSystem * gSystem
Definition TSystem.h:572
#define free
Definition civetweb.c:1578
#define O_BINARY
Definition civetweb.c:935
#define malloc
Definition civetweb.c:1575
void ResetErrno() const override
Method resetting the dc_errno and errno.
Bool_t fStatCached
! (transient) is file status cached?
Definition TDCacheFile.h:28
Bool_t ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf) override
Read the nbuf blocks described in arrays pos and len, where pos[i] is the seek position of block i of...
static Bool_t CheckFile(const char *path, const char *location=0)
CheckFile() returns kTRUE on success and kFALSE on failure.
Int_t SysSync(Int_t fd) override
Interface to system sync.
static void SetOnError(EOnErrorAction=kOnErrorDefault)
Set on error handler.
static void SetOpenTimeout(UInt_t secs)
Set file open timeout.
Long64_t SysSeek(Int_t fd, Long64_t offset, Int_t whence) override
Interface to system seek. All arguments like in POSIX lseek.
EOnErrorAction
Note: This must be kept in sync with values #defined in dcap.h.
Definition TDCacheFile.h:61
Int_t SysStat(Int_t fd, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime) override
Get info about a file: id, size, flags, modification time.
static Bool_t Stage(const char *path, UInt_t secs, const char *location=0)
Stage() returns kTRUE on success and kFALSE on failure.
~TDCacheFile() override
Close and cleanup dCache file.
struct stat64 fStatBuffer
! (transient) Cached file status buffer (for performance)
Definition TDCacheFile.h:29
static const char * GetDcapVersion()
Return dCache version string.
Int_t SysWrite(Int_t fd, const void *buf, Int_t len) override
Interface to system write. All arguments like in POSIX write.
Int_t SysOpen(const char *pathname, Int_t flags, UInt_t mode) override
Interface to system open. All arguments like in POSIX open.
Int_t SysRead(Int_t fd, void *buf, Int_t len) override
Interface to system read. All arguments like in POSIX read.
Int_t SysClose(Int_t fd) override
Interface to system close. All arguments like in POSIX close.
static TString GetDcapPath(const char *path)
Transform the input path into a path usuable by the dcap C library, i.e either dcap://nodename....
Bool_t ReadBuffer(char *buf, Int_t len) override
Read specified byte range from remote file via dCache daemon.
Bool_t WriteBuffer(const char *buf, Int_t len) override
Write specified byte range to remote file via dCache daemon.
static void SetReplyHostName(const char *host_name)
Set reply host name.
void * fDirp
directory handler
Definition TDCacheFile.h:82
Int_t MakeDirectory(const char *name) override
Create a directory.
Int_t GetPathInfo(const char *path, FileStat_t &buf) override
Get info about a file.
void * OpenDirectory(const char *name) override
Open a directory.
Bool_t AccessPathName(const char *path, EAccessMode mode) override
Returns FALSE if one can access a file using the specified access mode.
void FreeDirectory(void *dirp) override
Close a directory.
TDCacheSystem()
Create helper class that allows directory access via dCache.
const char * GetDirEntry(void *dirp) override
Get a directory entry.
Bool_t fWritable
True if directory is writable.
A cache when reading files over the network.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition TFile.h:131
Long64_t fBytesRead
Number of bytes read from this file.
Definition TFile.h:155
virtual void Seek(Long64_t offset, ERelativeTo pos=kBeg)
Seek to a specific position in the file. Pos it either kBeg, kCur or kEnd.
Definition TFile.cxx:2304
static void SetFileBytesRead(Long64_t bytes=0)
Definition TFile.cxx:4290
Int_t WriteBufferViaCache(const char *buf, Int_t len)
Write buffer via cache.
Definition TFile.cxx:2549
static Long64_t GetFileBytesRead()
Static function returning the total number of bytes read from all files.
Definition TFile.cxx:4256
Int_t ReadBufferViaCache(char *buf, Int_t len)
Read buffer via cache.
Definition TFile.cxx:1919
Long64_t fArchiveOffset
!Offset at which file starts in archive
Definition TFile.h:180
virtual Bool_t IsOpen() const
Returns kTRUE in case file is open and kFALSE if file is not open.
Definition TFile.cxx:1458
virtual void Init(Bool_t create)
Initialize a TFile object.
Definition TFile.cxx:616
TString fOption
File options.
Definition TFile.h:170
virtual Bool_t WriteBuffer(const char *buf, Int_t len)
Write a buffer to the file.
Definition TFile.cxx:2506
Int_t fD
File descriptor.
Definition TFile.h:161
TFileCacheRead * fCacheRead
!Pointer to the read cache (if any)
Definition TFile.h:177
TString fRealName
Effective real file name (not original url)
Definition TFile.h:169
virtual void SetOffset(Long64_t offset, ERelativeTo pos=kBeg)
Set position from where to start reading.
Definition TFile.cxx:2283
void Close(Option_t *option="") override
Close a file.
Definition TFile.cxx:958
virtual Bool_t ReadBuffer(char *buf, Int_t len)
Read a buffer from the file.
Definition TFile.cxx:1800
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:149
void MakeZombie()
Definition TObject.h:53
Basic string class.
Definition TString.h:138
void ToUpper()
Change string to upper case.
Definition TString.cxx:1202
Abstract base class defining a generic interface to the underlying Operating System.
Definition TSystem.h:276
static void ResetErrno()
Static function resetting system error number.
Definition TSystem.cxx:282
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Definition TSystem.cxx:1285
virtual const char * Getenv(const char *env)
Get environment variable.
Definition TSystem.cxx:1676
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Definition TSystem.cxx:1307
void SetErrorStr(const char *errstr)
Set the system error string.
Definition TSystem.cxx:243
This class represents a WWW compatible URL.
Definition TUrl.h:33
const Int_t n
Definition legend1.C:16
Int_t fMode
Definition TSystem.h:135
Long64_t fSize
Definition TSystem.h:138
Long_t fDev
Definition TSystem.h:133
Int_t fGid
Definition TSystem.h:137
Long_t fMtime
Definition TSystem.h:139
Long_t fIno
Definition TSystem.h:134
Bool_t fIsLink
Definition TSystem.h:140
Int_t fUid
Definition TSystem.h:136