Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TDavixFile.h
Go to the documentation of this file.
1// @(#)root/net:$Id$
2// Author: Adrien Devresse and Tigran Mkrtchyan
3
4/*************************************************************************
5 * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TDavixFile
13#define ROOT_TDavixFile
14
15//////////////////////////////////////////////////////////////////////////
16// //
17// TDavixFile //
18// //
19// A TDavixFile is like a normal TFile except that it uses //
20// libdavix to read/write remote files. //
21// It supports HTTP and HTTPS in a number of dialects and options //
22// e.g. S3 is one of them //
23// Other caracteristics come from the full support of Davix, //
24// e.g. full redirection support in any circumstance //
25// //
26// Authors: Adrien Devresse (CERN IT/SDC) //
27// Tigran Mkrtchyan (DESY) //
28// //
29// Checks, refactoring and ROOT5 porting: //
30// Fabrizio Furano (CERN IT/SDC) //
31// //
32// September 2013 //
33// //
34//////////////////////////////////////////////////////////////////////////
35
36//
37// Parameters that influence the behavior of TDavixFile/TDavixSystem. The names should be self-explanatory
38//
39//Davix.Debug
40//Davix.GSI.UserProxy
41//Davix.GSI.UserCert
42//Davix.GSI.UserKey
43
44//Davix.GSI.CAdir
45//Davix.GSI.CACheck
46//Davix.GSI.GridMode
47//
48//Davix.S3.AccessKey
49//Davix.S3.SecretKey
50//Davix.S3.Region
51//Davix.S3.Token
52//
53// Environment variables:
54// X509_USER_CERT, X509_USER_KEY, X509_USER_PROXY ... usual meaning for the X509 Grid things. gEnv vars have higher priority.
55// S3_ACCESS_KEY, S3_SECRET_KEY, S3_REGION, S3_TOKEN. gEnv vars have higher priority.
56
57#include "TFile.h"
58
60struct Davix_fd;
61
62namespace ROOT {
63namespace Experimental {
64class RLogChannel;
65}
66}
67
69
70class TDavixFile : public TFile {
71private:
73
74 void Init(Bool_t init);
75 Long64_t DavixReadBuffer(Davix_fd *fd, char *buf, Int_t len);
76 Long64_t DavixPReadBuffer(Davix_fd *fd, char *buf, Long64_t pos, Int_t len);
77 Long64_t DavixReadBuffers(Davix_fd *fd, char *buf, Long64_t *pos, Int_t *len, Int_t nbuf);
78 Long64_t DavixWriteBuffer(Davix_fd *fd, const char *buf, Int_t len);
79 Int_t DavixStat(struct stat *st) const;
80
81 // perfStats
83 void eventStop(Double_t t, Long64_t len, bool read = true);
84
85public:
86 ///
87 /// Open function for TDavixFile
88 ///
89 /// TDavixFile supports several options :
90 ///
91 /// - GRID_MODE=yes : enable the grid authentication and CA support
92 /// - CA_CHECK=no : remove all the certificate authority check, this option can create a security vulnerability
93 /// - S3SECKEY=string : Amazon S3 secret token
94 /// - S3ACCKEY=string : Amazon S3 access token
95 /// - S3REGION=string : Amazon S3 region. Optional, if provided, davix will use v4 signatures.
96 /// - S3TOKEN=string : Amazon STS temporary credentials token.
97 ///
98 /// Several parameters can be used if separated with whitespace
99
100 TDavixFile(const char* url, Option_t *option="", const char *ftitle="", Int_t compress = ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault);
101
102 ~TDavixFile();
103
104 // TFile interface.
105 virtual Long64_t GetSize() const;
106 virtual void Seek(Long64_t offset, ERelativeTo pos = kBeg);
107 virtual Bool_t ReadBuffer(char *buf, Int_t len);
108 virtual Bool_t ReadBuffer(char *buf, Long64_t pos, Int_t len);
109 virtual Bool_t ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf);
110 virtual Bool_t ReadBufferAsync(Long64_t offs, Int_t len);
111 virtual Bool_t WriteBuffer(const char *buffer, Int_t bufferLength);
112 virtual TString GetNewUrl();
113
114 // TDavixFile options
115 /// Enable or disable certificate authority check
116 void setCACheck(Bool_t check);
117
118 // Determine the value of the current token from the process's environment.
119 // Follows the WLCG Bearer Token Discovery schema.
120 // On error or no token discovered, returns the empty string.
121 std::string DiscoverToken();
122
123 /// Enable the grid mode
124 /// The grid Mode configure automatically all grid-CA path, VOMS authentication
125 /// and grid related extension for a grid analysis usage
126 void enableGridMode();
127
129};
130
131#endif
long long Long64_t
Definition RtypesCore.h:80
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:337
ROOT::Experimental::RLogChannel & TDavixLogChannel()
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 Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
A log configuration for a channel, e.g.
Definition RLogger.hxx:101
virtual Long64_t GetSize() const
Returns the current file size.
void Init(Bool_t init)
Initialize a TFile object.
Int_t DavixStat(struct stat *st) const
Long64_t DavixReadBuffers(Davix_fd *fd, char *buf, Long64_t *pos, Int_t *len, Int_t nbuf)
Long64_t DavixReadBuffer(Davix_fd *fd, char *buf, Int_t len)
Long64_t DavixPReadBuffer(Davix_fd *fd, char *buf, Long64_t pos, Int_t len)
virtual Bool_t WriteBuffer(const char *buffer, Int_t bufferLength)
Write a buffer to the file.
virtual TString GetNewUrl()
Long64_t DavixWriteBuffer(Davix_fd *fd, const char *buf, Int_t len)
virtual Bool_t ReadBufferAsync(Long64_t offs, Int_t len)
virtual Bool_t ReadBuffer(char *buf, Int_t len)
Read specified byte range from remote file via HTTP.
std::string DiscoverToken()
void enableGridMode()
Enable the grid mode The grid Mode configure automatically all grid-CA path, VOMS authentication and ...
virtual void Seek(Long64_t offset, ERelativeTo pos=kBeg)
Set position from where to start reading.
TDavixFileInternal * d_ptr
Definition TDavixFile.h:72
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.
void eventStop(Double_t t, Long64_t len, bool read=true)
set TFile state info
void setCACheck(Bool_t check)
Enable or disable certificate authority check.
Double_t eventStart()
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition TFile.h:53
ERelativeTo
Definition TFile.h:199
@ kBeg
Definition TFile.h:199
Basic string class.
Definition TString.h:139
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
@ kUseCompiledDefault
Use the compile-time default setting.
Definition Compression.h:52