File indexing completed on 2025-01-18 10:12:17
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef ROOT_TNetXNGFile
0011 #define ROOT_TNetXNGFile
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #include "TFile.h"
0025 #include "TSemaphore.h"
0026 #ifndef __CLING__
0027 #include <XrdCl/XrdClFileSystem.hh>
0028 #endif
0029
0030 namespace XrdCl {
0031 class File;
0032 class URL;
0033 }
0034 class XrdSysCondVar;
0035
0036 #ifdef __CLING__
0037 namespace XrdCl {
0038 struct OpenFlags {
0039 enum Flags {None = 0};
0040 };
0041 }
0042 #endif
0043
0044 class TNetXNGFile: public TFile {
0045 private:
0046 XrdCl::File *fFile;
0047 XrdCl::URL *fUrl;
0048 XrdCl::OpenFlags::Flags fMode;
0049 XrdSysCondVar *fInitCondVar;
0050
0051 Int_t fReadvIorMax;
0052 Int_t fReadvIovMax;
0053 Int_t fQueryReadVParams;
0054 TString fNewUrl;
0055
0056 public:
0057 TNetXNGFile() : TFile(),
0058 fFile(nullptr), fUrl(nullptr), fMode(XrdCl::OpenFlags::None), fInitCondVar(nullptr),
0059 fReadvIorMax(0), fReadvIovMax(0) {}
0060 TNetXNGFile(const char *url, const char *lurl, Option_t *mode, const char *title,
0061 Int_t compress, Int_t netopt, Bool_t parallelopen);
0062 TNetXNGFile(const char *url, Option_t *mode = "", const char *title = "",
0063 Int_t compress = 1, Int_t netopt = 0, Bool_t parallelopen = kFALSE);
0064
0065 virtual ~TNetXNGFile();
0066
0067 void Init(Bool_t create) override;
0068 void Close(const Option_t *option = "") override;
0069 void Seek(Long64_t offset, ERelativeTo position = kBeg) override;
0070 virtual void SetAsyncOpenStatus(EAsyncOpenStatus status);
0071 Long64_t GetSize() const override;
0072 Int_t ReOpen(Option_t *modestr) override;
0073 Bool_t IsOpen() const override;
0074 Bool_t WriteBuffer(const char *buffer, Int_t length) override;
0075 void Flush() override;
0076 Bool_t ReadBuffer(char *buffer, Int_t length) override;
0077 Bool_t ReadBuffer(char *buffer, Long64_t position, Int_t length) override;
0078 Bool_t ReadBuffers(char *buffer, Long64_t *position, Int_t *length,
0079 Int_t nbuffs) override;
0080 TString GetNewUrl() override { return fNewUrl; }
0081
0082 private:
0083 virtual Bool_t IsUseable() const;
0084 virtual Bool_t GetVectorReadLimits();
0085 virtual void SetEnv();
0086 Int_t ParseOpenMode(Option_t *in, TString &modestr,
0087 XrdCl::OpenFlags::Flags &mode, Bool_t assumeRead);
0088
0089 TNetXNGFile(const TNetXNGFile &other);
0090 TNetXNGFile &operator =(const TNetXNGFile &other);
0091
0092 ClassDefOverride(TNetXNGFile, 0)
0093 };
0094
0095 #endif