![]() |
|
|||
File indexing completed on 2025-09-15 09:12:31
0001 // @(#)root/net:$Id$ 0002 // Author: Adrien Devresse and Tigran Mkrtchyan 0003 0004 /************************************************************************* 0005 * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers. * 0006 * All rights reserved. * 0007 * * 0008 * For the licensing terms see $ROOTSYS/LICENSE. * 0009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 0010 *************************************************************************/ 0011 0012 #ifndef ROOT_TDavixFile 0013 #define ROOT_TDavixFile 0014 0015 ////////////////////////////////////////////////////////////////////////// 0016 // // 0017 // TDavixFile // 0018 // // 0019 // A TDavixFile is like a normal TFile except that it uses // 0020 // libdavix to read/write remote files. // 0021 // It supports HTTP and HTTPS in a number of dialects and options // 0022 // e.g. S3 is one of them // 0023 // Other caracteristics come from the full support of Davix, // 0024 // e.g. full redirection support in any circumstance // 0025 // // 0026 // Authors: Adrien Devresse (CERN IT/SDC) // 0027 // Tigran Mkrtchyan (DESY) // 0028 // // 0029 // Checks, refactoring and ROOT5 porting: // 0030 // Fabrizio Furano (CERN IT/SDC) // 0031 // // 0032 // September 2013 // 0033 // // 0034 ////////////////////////////////////////////////////////////////////////// 0035 0036 // 0037 // Parameters that influence the behavior of TDavixFile/TDavixSystem. The names should be self-explanatory 0038 // 0039 //Davix.Debug 0040 //Davix.GSI.UserProxy 0041 //Davix.GSI.UserCert 0042 //Davix.GSI.UserKey 0043 0044 //Davix.GSI.CAdir 0045 //Davix.GSI.CACheck 0046 //Davix.GSI.GridMode 0047 // 0048 //Davix.S3.AccessKey 0049 //Davix.S3.SecretKey 0050 //Davix.S3.Region 0051 //Davix.S3.Token 0052 // 0053 // Environment variables: 0054 // X509_USER_CERT, X509_USER_KEY, X509_USER_PROXY ... usual meaning for the X509 Grid things. gEnv vars have higher priority. 0055 // S3_ACCESS_KEY, S3_SECRET_KEY, S3_REGION, S3_TOKEN. gEnv vars have higher priority. 0056 0057 #include "TFile.h" 0058 0059 class TDavixFileInternal; 0060 struct Davix_fd; 0061 0062 namespace ROOT { 0063 class RLogChannel; 0064 ROOT::RLogChannel &TDavixLogChannel(); 0065 } // namespace ROOT 0066 0067 class TDavixFile : public TFile { 0068 private: 0069 TDavixFileInternal* d_ptr; 0070 0071 void Init(Bool_t init); 0072 Long64_t DavixReadBuffer(Davix_fd *fd, char *buf, Int_t len); 0073 Long64_t DavixPReadBuffer(Davix_fd *fd, char *buf, Long64_t pos, Int_t len); 0074 Long64_t DavixReadBuffers(Davix_fd *fd, char *buf, Long64_t *pos, Int_t *len, Int_t nbuf); 0075 Long64_t DavixWriteBuffer(Davix_fd *fd, const char *buf, Int_t len); 0076 Int_t DavixStat(struct stat *st) const; 0077 0078 // perfStats 0079 Double_t eventStart(); 0080 void eventStop(Double_t t, Long64_t len, bool read = true); 0081 0082 public: 0083 /// 0084 /// Open function for TDavixFile 0085 /// 0086 /// TDavixFile supports several options : 0087 /// 0088 /// - GRID_MODE=yes : enable the grid authentication and CA support 0089 /// - CA_CHECK=no : remove all the certificate authority check, this option can create a security vulnerability 0090 /// - S3SECKEY=string : Amazon S3 secret token 0091 /// - S3ACCKEY=string : Amazon S3 access token 0092 /// - S3REGION=string : Amazon S3 region. Optional, if provided, davix will use v4 signatures. 0093 /// - S3TOKEN=string : Amazon STS temporary credentials token. 0094 /// 0095 /// Several parameters can be used if separated with whitespace 0096 0097 TDavixFile(const char* url, Option_t *option="", const char *ftitle="", Int_t compress = ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault); 0098 0099 ~TDavixFile(); 0100 0101 // TFile interface. 0102 virtual Long64_t GetSize() const; 0103 virtual void Seek(Long64_t offset, ERelativeTo pos = kBeg); 0104 virtual Bool_t ReadBuffer(char *buf, Int_t len); 0105 virtual Bool_t ReadBuffer(char *buf, Long64_t pos, Int_t len); 0106 virtual Bool_t ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf); 0107 virtual Bool_t ReadBufferAsync(Long64_t offs, Int_t len); 0108 virtual Bool_t WriteBuffer(const char *buffer, Int_t bufferLength); 0109 virtual TString GetNewUrl(); 0110 0111 // TDavixFile options 0112 /// Enable or disable certificate authority check 0113 void setCACheck(Bool_t check); 0114 0115 // Determine the value of the current token from the process's environment. 0116 // Follows the WLCG Bearer Token Discovery schema. 0117 // On error or no token discovered, returns the empty string. 0118 std::string DiscoverToken(); 0119 0120 /// Enable the grid mode 0121 /// The grid Mode configure automatically all grid-CA path, VOMS authentication 0122 /// and grid related extension for a grid analysis usage 0123 void enableGridMode(); 0124 0125 ClassDef(TDavixFile, 0) 0126 }; 0127 0128 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |