Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TNetXNGFile.h
Go to the documentation of this file.
1
2/*************************************************************************
3 * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers. *
4 * All rights reserved. *
5 * *
6 * For the licensing terms see $ROOTSYS/LICENSE. *
7 * For the list of contributors see $ROOTSYS/README/CREDITS. *
8 *************************************************************************/
9
10#ifndef ROOT_TNetXNGFile
11#define ROOT_TNetXNGFile
12
13////////////////////////////////////////////////////////////////////////////////
14// //
15// TNetXNGFile //
16// //
17// Authors: Justin Salmon, Lukasz Janyst //
18// CERN, 2013 //
19// //
20// Enables access to XRootD files using the new client. //
21// //
22////////////////////////////////////////////////////////////////////////////////
23
24#include "TFile.h"
25#include "TSemaphore.h"
26
27namespace XrdCl {
28 class File;
29 class URL;
30}
31class XrdSysCondVar;
32
33class TNetXNGFile: public TFile {
34private:
35 XrdCl::File *fFile; // Underlying XRootD file
36 XrdCl::URL *fUrl; // URL of the current file
37 int fMode; // Open mode of the current file
38 XrdSysCondVar *fInitCondVar; // Used to block an async open request
39 // if requested
40 Int_t fReadvIorMax; // Max size of a single readv chunk
41 Int_t fReadvIovMax; // Max number of readv chunks
44
45public:
47 TNetXNGFile(const char *url, const char *lurl, Option_t *mode, const char *title,
48 Int_t compress, Int_t netopt, Bool_t parallelopen);
49 TNetXNGFile(const char *url, Option_t *mode = "", const char *title = "",
50 Int_t compress = 1, Int_t netopt = 0, Bool_t parallelopen = kFALSE);
51
52 virtual ~TNetXNGFile();
53
54 void Init(Bool_t create) override;
55 void Close(const Option_t *option = "") override;
56 void Seek(Long64_t offset, ERelativeTo position = kBeg) override;
57 virtual void SetAsyncOpenStatus(EAsyncOpenStatus status);
58 Long64_t GetSize() const override;
59 Int_t ReOpen(Option_t *modestr) override;
60 Bool_t IsOpen() const override;
61 Bool_t WriteBuffer(const char *buffer, Int_t length) override;
62 void Flush() override;
63 Bool_t ReadBuffer(char *buffer, Int_t length) override;
64 Bool_t ReadBuffer(char *buffer, Long64_t position, Int_t length) override;
65 Bool_t ReadBuffers(char *buffer, Long64_t *position, Int_t *length,
66 Int_t nbuffs) override;
67 TString GetNewUrl() override { return fNewUrl; }
68
69private:
70 virtual Bool_t IsUseable() const;
72 virtual void SetEnv();
73
74 TNetXNGFile(const TNetXNGFile &other); // Not implemented
75 TNetXNGFile &operator =(const TNetXNGFile &other); // Not implemented
76
77 ClassDefOverride(TNetXNGFile, 0) // ROOT class definition
78};
79
80#endif // ROOT_TNetXNGFile
bool Bool_t
Definition RtypesCore.h:63
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
long long Long64_t
Definition RtypesCore.h:69
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
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 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 length
Option_t Option_t TPoint TPoint const char mode
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition TFile.h:53
EAsyncOpenStatus
Asynchronous open request status.
Definition TFile.h:64
ERelativeTo
Definition TFile.h:199
@ kBeg
Definition TFile.h:199
XrdCl::File * fFile
Definition TNetXNGFile.h:35
void Seek(Long64_t offset, ERelativeTo position=kBeg) override
Set the position within the file.
TString GetNewUrl() override
Definition TNetXNGFile.h:67
virtual void SetEnv()
Map ROOT and xrootd environment variables.
Int_t fReadvIovMax
Definition TNetXNGFile.h:41
XrdCl::URL * fUrl
Definition TNetXNGFile.h:36
virtual Bool_t IsUseable() const
Check the file is open and isn't a zombie.
virtual void SetAsyncOpenStatus(EAsyncOpenStatus status)
Set the status of an asynchronous file open.
Bool_t ReadBuffer(char *buffer, Int_t length) override
Read a data chunk of the given size.
TNetXNGFile(const TNetXNGFile &other)
void Close(const Option_t *option="") override
Close the file.
Bool_t ReadBuffers(char *buffer, Long64_t *position, Int_t *length, Int_t nbuffs) override
Read scattered data chunks in one operation.
void Flush() override
Synchronize a file's in-memory and on-disk states.
Bool_t WriteBuffer(const char *buffer, Int_t length) override
Write a data chunk.
TString fNewUrl
Definition TNetXNGFile.h:43
Int_t fQueryReadVParams
Definition TNetXNGFile.h:42
Int_t ReOpen(Option_t *modestr) override
Reopen the file with the new access mode.
XrdSysCondVar * fInitCondVar
Definition TNetXNGFile.h:38
Long64_t GetSize() const override
Get the file size.
virtual ~TNetXNGFile()
Destructor.
Int_t fReadvIorMax
Definition TNetXNGFile.h:40
void Init(Bool_t create) override
Initialize the file.
virtual Bool_t GetVectorReadLimits()
Find the server-specific readv config params.
Bool_t IsOpen() const override
Check if the file is open.
TNetXNGFile & operator=(const TNetXNGFile &other)
Basic string class.
Definition TString.h:139