88 std::optional<TKeyMapNode>
fCur;
91 std::optional<TKeyMapNode>
Next();
282#if defined(__clang__) && __clang_major__ < 20
283#pragma clang diagnostic push
284#pragma clang diagnostic ignored "-Wshadow"
287#if defined(__clang__) && __clang_major__ < 20
288#pragma clang diagnostic pop
303 void Delete(
const char *namecycle=
"")
override;
307 virtual void Flush();
352 virtual void MakeProject(
const char *dirname,
const char *classes=
"*",
429 UInt_t buffersize = 1000000);
439#define gFile (TFile::CurrentFile())
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
unsigned short UShort_t
Unsigned Short integer 2 bytes (unsigned short).
int Int_t
Signed integer 4 bytes (int).
short Version_t
Class version identifier (short).
char Char_t
Character 1 byte (char).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
bool Bool_t
Boolean (0=false, 1=true) (bool).
short Short_t
Signed Short integer 2 bytes (short).
double Double_t
Double 8 bytes.
long long Long64_t
Portable signed long integer 8 bytes.
float Float_t
Float 4 bytes (float).
const char Option_t
Option string (const char).
#define ClassDefOverride(name, id)
std::optional< TKeyMapNode > fCur
std::optional< TKeyMapNode > Next()
bool operator!=(const iterator &rh) const
TIterator(TFile *file, std::uint64_t addr)
std::ptrdiff_t difference_type
std::input_iterator_tag iterator_category
bool operator==(const iterator &rh) const
TKeyMapIterable(TFile *file)
This class is a thread-safe associative collection connecting a 256 bits digest/hash to a collection ...
Class describing an archive file containing multiple sub-files, like a ZIP or TAR archive.
Array of chars or bytes (8 bits per element).
TClass instances represent classes, structs and namespaces in the ROOT type system.
Describe directory structure in memory.
TDirectory(const TDirectory &directory)=delete
A cache when reading files over the network.
A cache when writing files over the network.
Class holding info about the file being opened.
TFile * fFile
TFile instance of the file being opened.
Int_t fNetOpt
Network options.
TFileOpenHandle(TFile *f)
TFileOpenHandle(const char *n, const char *o, const char *t, Int_t cmp, Int_t no)
TFileOpenHandle & operator=(const TFileOpenHandle &)=delete
Int_t fCompress
Compression level and algorithm.
const char * GetOpt() const
TFileOpenHandle(const TFileOpenHandle &)=delete
Bool_t Matches(const char *name)
Return kTRUE if this async request matches the open request specified by 'url'.
~TFileOpenHandle() override
Int_t GetCompress() const
The prefetching mechanism uses two classes (TFilePrefetch and TFPBlock) to prefetch in advance a bloc...
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
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)
static Bool_t fgCacheFileForce
Indicates, to force all READ to CACHEREAD.
Long64_t fBytesRead
Number of bytes read from this file.
friend class TFilePrefetch
virtual Long64_t GetSeekFree() const
virtual TProcessID * ReadProcessID(UShort_t pidf)
The TProcessID with number pidf is read from this file.
void ls(Option_t *option="") const override
List file contents.
ROOT::Detail::TKeyMapIterable WalkTKeys()
Traverses all TKeys in the TFile and returns information about them.
virtual void Seek(Long64_t offset, ERelativeTo pos=kBeg)
Seek to a specific position in the file. Pos it either kBeg, kCur or kEnd.
static Bool_t GetOnlyStaged()
Returns staged only flag.
static void IncrementFileCounter()
static Bool_t ShrinkCacheFileDir(Long64_t shrinkSize, Long_t cleanupInteval=0)
Try to shrink the cache to the desired size.
Long64_t fSeekFree
Location on disk of free segments structure.
static Int_t fgReadaheadSize
Readahead buffer size.
void FillBuffer(char *&buffer) override
Encode file output buffer.
Double_t fSum2Buffer
Sum of squares of buffer sizes of objects written so far.
static void SetReadaheadSize(Int_t bufsize=256000)
static Bool_t fgCacheFileDisconnected
Indicates, we trust in the files in the cache dir without stat on the cached file.
const TList * GetStreamerInfoCache()
Returns the cached list of StreamerInfos used in this file.
static Bool_t GetReadStreamerInfo()
If the streamerinfos are to be read at file opening.
TArchiveFile * fArchive
!Archive file from which we read this file
virtual Int_t SysSync(Int_t fd)
Interface to system fsync. All arguments like in POSIX fsync().
virtual Long64_t DirCreateEntry(TDirectory *)
virtual Int_t ReOpen(Option_t *mode)
Reopen a file with a different access mode.
virtual void ReadStreamerInfo()
Read the list of StreamerInfo from this file.
virtual Bool_t Matches(const char *name)
Return kTRUE if 'url' matches the coordinates of this file.
virtual void SetCacheRead(TFileCacheRead *cache, TObject *tree=nullptr, ECacheAction action=kDisconnect)
Set a pointer to the read cache.
TArrayC * fClassIndex
!Index of TStreamerInfo classes written to this file
static Long64_t GetFileBytesWritten()
Static function returning the total number of bytes written to all files.
virtual InfoListRet GetStreamerInfoListImpl(bool lookupSICache)
See documentation of GetStreamerInfoList for more details.
Int_t GetCompressionSettings() const
static void SetReadStreamerInfo(Bool_t readinfo=kTRUE)
Specify if the streamerinfos must be read at file opening.
Bool_t fNoAnchorInName
!True if we don't want to force the anchor to be appended to the file name
virtual Int_t DirReadKeys(TDirectory *)
static void SetFileBytesRead(Long64_t bytes=0)
TArrayC * GetClassIndex() const
Long64_t fSeekInfo
Location on disk of StreamerInfo record.
void Paint(Option_t *option="") override
Paint all objects in the file.
TList * GetListOfFree() const
Int_t GetBestBuffer() const
Return the best buffer size of objects on this file.
TList * fOpenPhases
!Time info about open phases
virtual void SetCompressionLevel(Int_t level=ROOT::RCompressionSetting::ELevel::kUseMin)
See comments for function SetCompressionSettings.
TFileCacheWrite * GetCacheWrite() const
Return a pointer to the current write cache.
static void SetFileReadCalls(Int_t readcalls=0)
static TString fgCacheFileDir
Directory where to locally stage files.
virtual Int_t SysRead(Int_t fd, void *buf, Int_t len)
Interface to system read. All arguments like in POSIX read().
Int_t fVersion
File format version.
void Print(Option_t *option="") const override
Print all objects in the file.
static std::atomic< Long64_t > fgFileCounter
Counter for all opened files.
virtual EAsyncOpenStatus GetAsyncOpenStatus()
static UInt_t GetOpenTimeout()
Returns open timeout (in ms).
void Copy(TObject &) const override
Copy this to obj.
static void CpProgress(Long64_t bytesread, Long64_t size, TStopwatch &watch)
Print file copy progress.
Long64_t GetArchiveOffset() const
static Bool_t fgOnlyStaged
Before the file is opened, it is checked, that the file is staged, if not, the open fails.
virtual Int_t GetNProcessIDs() const
Bool_t fMustFlush
!True if the file buffers must be flushed
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.
void operator=(const TFile &)=delete
virtual TKey * CreateKey(TDirectory *mother, const TObject *obj, const char *name, Int_t bufsize)
Creates key for object and converts data to buffer.
virtual void WriteFree()
Write FREE linked list on the file.
static Int_t GetReadaheadSize()
Static function returning the readahead buffer size.
~TFile() override
File destructor.
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.
static Long64_t GetFileCounter()
TMap * fCacheReadMap
!Pointer to the read cache (if any)
Long64_t fBEGIN
First used byte in file.
virtual UShort_t WriteProcessID(TProcessID *pid)
Check if the ProcessID pidd is already in the file, if not, add it and return the index number in the...
virtual void MakeProject(const char *dirname, const char *classes="*", Option_t *option="new")
Generate source code necessary to access the objects stored in the file.
friend class TDirectoryFile
Long64_t fArchiveOffset
!Offset at which file starts in archive
EOpenTimeOut
Open timeout constants.
Int_t fNbytesInfo
Number of bytes for StreamerInfo record.
virtual Long64_t GetSize() const
Returns the current file size.
virtual Bool_t IsOpen() const
Returns kTRUE in case file is open and kFALSE if file is not open.
TFileOpenHandle * fAsyncHandle
!For proper automatic cleanup
static Bool_t SetOnlyStaged(Bool_t onlystaged)
Sets only staged flag.
virtual Int_t GetReadCalls() const
virtual Bool_t Cp(const char *dst, Bool_t progressbar=kTRUE, UInt_t bufsize=1000000)
Allows to copy this file to the dst URL.
virtual TString GetNewUrl()
Int_t Write(const char *name=nullptr, Int_t opt=0, Int_t bufsize=0) override
Write memory objects to this file.
virtual Long64_t GetBytesRead() const
virtual Int_t GetErrno() const
Method returning errno.
virtual void SetCompressionSettings(Int_t settings=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault)
Used to specify the compression level and algorithm.
Int_t GetCompressionLevel() const
static Bool_t fgReadInfo
if true (default) ReadStreamerInfo is called when opening a file
virtual void Init(Bool_t create)
Initialize a TFile object.
TFile(const TFile &)=delete
Long64_t GetRelOffset() const
virtual void SetReadCalls(Int_t readcalls=0)
static TFileOpenHandle * AsyncOpen(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Submit an asynchronous open request.
virtual void SetCacheWrite(TFileCacheWrite *cache)
Set a pointer to the write cache.
TString fOption
File options.
virtual Int_t GetNfree() const
virtual Long64_t GetEND() const
virtual Bool_t WriteBuffer(const char *buf, Int_t len)
Write a buffer to the file.
void SumBuffer(Int_t bufsize)
Increment statistics for buffer sizes of objects in this file.
static const char * GetCacheFileDir()
Get the directory where to locally stage/cache remote files.
EAsyncOpenStatus
Asynchronous open request status.
virtual void WriteStreamerInfo()
Write the list of TStreamerInfo as a single object in this file The class Streamer description for al...
virtual Long64_t GetBytesWritten() const
Return the total number of bytes written so far to the file.
virtual Long64_t GetSeekInfo() const
Int_t fCompress
Compression level and algorithm.
virtual Int_t GetNbytesFree() const
virtual Bool_t IsArchive() const
static TFile *& CurrentFile()
Return the current ROOT file if any.
virtual void SetEND(Long64_t last)
virtual void SetCompressionAlgorithm(Int_t algorithm=ROOT::RCompressionSetting::EAlgorithm::kUseGlobal)
See comments for function SetCompressionSettings.
virtual const TUrl * GetEndpointUrl() const
Int_t fNbytesFree
Number of bytes for free segments structure.
virtual void ResetErrno() const
Method resetting the errno.
Int_t Sizeof() const override
Return the size in bytes of the file header.
Bool_t FlushWriteCache()
Flush the write cache if active.
virtual void IncrementProcessIDs()
Bool_t fIsPcmFile
!True if the file is a ROOT pcm file.
TFileCacheRead * fCacheRead
!Pointer to the read cache (if any)
virtual Int_t SysClose(Int_t fd)
Interface to system close. All arguments like in POSIX close().
TFile()
File default Constructor.
Char_t fUnits
Number of bytes for file pointers.
TObjArray * fProcessIDs
!Array of pointers to TProcessIDs
static EFileType GetType(const char *name, Option_t *option="", TString *prefix=nullptr)
Resolve the file type as a function of the protocol field in 'name'.
virtual void SetOption(Option_t *option=">")
virtual void ShowStreamerInfo()
Show the StreamerInfo of all classes written to this file.
virtual Long64_t SysSeek(Int_t fd, Long64_t offset, Int_t whence)
Interface to system lseek.
virtual Int_t SysStat(Int_t fd, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime)
Return file stat information.
virtual Long64_t GetBytesReadExtra() const
virtual Int_t SysOpen(const char *pathname, Int_t flags, UInt_t mode)
Interface to system open. All arguments like in POSIX open().
ECacheAction
TTreeCache flushing semantics.
static UInt_t SetOpenTimeout(UInt_t timeout)
Sets open timeout time (in ms). Returns previous timeout value.
virtual void ReadFree()
Read the FREE linked list.
static ROOT::Internal::RConcurrentHashColl fgTsSIHashes
!TS Set of hashes built from read streamer infos
Long64_t fBytesReadExtra
Number of extra bytes (overhead) read by the readahead buffer.
Long64_t fBytesWrite
Number of bytes written to this file.
TArchiveFile * GetArchive() const
Bool_t fIsRootFile
!True is this is a ROOT file, raw file otherwise
virtual void Flush()
Synchronize a file's in-memory and on-disk states.
virtual void DirWriteKeys(TDirectory *)
TList * fFree
Free segments linked list table.
virtual Bool_t ReadBufferAsync(Long64_t offs, Int_t len)
std::mutex fWriteMutex
!Lock for writing baskets / keys into the file.
void Delete(const char *namecycle="") override
Delete Objects or/and keys in a directory.
Bool_t fInitDone
!True if the file has been initialized
virtual void DrawMap(const char *keys="*", Option_t *option="")
Draw map of objects in this file.
virtual void DirWriteHeader(TDirectory *)
virtual void MakeFree(Long64_t first, Long64_t last)
Mark unused bytes on the file.
TFileCacheWrite * fCacheWrite
!Pointer to the write cache (if any)
TString fRealName
Effective real file name (not original url).
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.
virtual Int_t GetNbytesInfo() const
TList * fInfoCache
!Cached list of the streamer infos in this file
virtual Bool_t MustFlush() const
virtual Int_t GetBytesToPrefetch() const
Max number of bytes to prefetch.
static UInt_t fgOpenTimeout
Timeout for open operations in ms - 0 corresponds to blocking i/o.
Long64_t fEND
Last used byte in file.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
static Bool_t SetCacheFileDir(std::string_view cacheDir, Bool_t operateDisconnected=kTRUE, Bool_t forceCacheread=kFALSE)
Sets the directory where to locally stage/cache remote files.
EAsyncOpenStatus fAsyncOpenStatus
!Status of an asynchronous open request
bool fGlobalRegistration
! if true, bypass use of global lists
Double_t fSumBuffer
Sum of buffer sizes of objects written so far.
Bool_t fIsArchive
!True if this is a pure archive file
TObjArray * GetListOfProcessIDs() const
void Close(Option_t *option="") override
Close a file.
Int_t GetCompressionAlgorithm() const
static std::atomic< Int_t > fgReadCalls
Number of bytes read from all TFile objects.
virtual Int_t Recover()
Attempt to recover file if not correctly closed.
virtual TList * GetStreamerInfoList() final
Read the list of TStreamerInfo objects written to this file.
virtual void WriteHeader()
Write File Header.
EStatusBits
TFile status bits. BIT(13) is taken up by TObject.
@ kCancelTTreeChangeRequest
@ k630forwardCompatibility
static TFile * OpenFromCache(const char *name, Option_t *="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Open a file for reading through the file cache.
Int_t fNProcessIDs
Number of TProcessID written to this file.
Int_t fWritten
Number of objects written so far.
Int_t GetRecordHeader(char *buf, Long64_t first, Int_t maxbytes, Int_t &nbytes, Int_t &objlen, Int_t &keylen)
Read the logical record header starting at a certain postion.
virtual Bool_t ReadBuffer(char *buf, Int_t len)
Read a buffer from the file.
Float_t GetCompressionFactor()
Return the file compression factor.
virtual Int_t SysWrite(Int_t fd, const void *buf, Int_t len)
Interface to system write. All arguments like in POSIX write().
static Int_t GetFileReadCalls()
Static function returning the total number of read calls from all files.
TFileCacheRead * GetCacheRead(const TObject *tree=nullptr) const
Return a pointer to the current read cache.
Option_t * GetOption() const override
static TList * fgAsyncOpenRequests
Book space in a file, create I/O buffers, to fill them, (un)compress them.
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Mother of all ROOT objects.
Bool_t TestBit(UInt_t f) const
void MayNotUse(const char *method) const
Use this method to signal that a method (defined in a base class) may not be called in a derived clas...
A TProcessID identifies a ROOT job in a unique way in time and space.
This class represents a WWW compatible URL.
Special implementation of ROOT::RRangeCast for TCollection, including a check that the cast target ty...
TKeyMapNode(std::uint64_t addr, EType type, std::uint32_t len=0)
@ kUseGlobal
Use the global compression algorithm.
@ kUseCompiledDefault
Use the compile-time default setting.
@ kUseMin
Compression level reserved when we are not sure what to use (1 is for the fastest compression).
Simple struct of the return value of GetStreamerInfoListImpl.
ROOT::Internal::RConcurrentHashColl::HashValue fHash