Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TDavixFileInternal.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_TDavixFileInternal
13#define ROOT_TDavixFileInternal
14
15#include "TUrl.h"
16#include "TMutex.h"
17
18#include <vector>
19#include <iterator>
20#include <algorithm>
21#include <errno.h>
22#include <stdlib.h>
23#include <unistd.h>
24#include <fcntl.h>
25#include <sys/stat.h>
26#include <sstream>
27#include <string>
28#include <cstring>
29
30//////////////////////////////////////////////////////////////////////////
31// //
32// TDavixFileInternal //
33// //
34// //
35// Support class, common to TDavixFile and TDavixSystem //
36// //
37// Authors: Adrien Devresse (CERN IT/SDC) //
38// Fabrizio Furano (CERN IT/SDC) //
39// //
40// September 2013 //
41// //
42//////////////////////////////////////////////////////////////////////////
43
44namespace Davix {
45 class Context;
46 class RequestParams;
47 class DavPosix;
48 class DavFile;
49}
50struct Davix_fd;
51
52
54 friend class TDavixFile;
55 friend class TDavixSystem;
56
57private:
58 TDavixFileInternal(const TUrl & mUrl, Option_t* mopt) :
60 openLock(),
62 davixParam(nullptr),
63 davixPosix(nullptr),
64 davixFd(nullptr),
65 fUrl(mUrl),
66 opt(mopt),
67 oflags(0),
68 dirdVec() { }
69
70 TDavixFileInternal(const char* url, Option_t* mopt) :
72 openLock(),
74 davixParam(nullptr),
75 davixPosix(nullptr),
76 davixFd(nullptr),
77 fUrl(url),
78 opt(mopt),
79 oflags(0),
80 dirdVec() { }
81
83
85 {
86 // singleton init
87 if (davixFd == nullptr) {
89 if (davixFd == nullptr) {
90 davixFd = this->Open();
91 }
92 }
93 return davixFd;
94 }
95
96 Davix_fd * Open();
97
98 void Close();
99
100 void enableGridMode();
101
102 void setAwsRegion(const std::string & region);
103 void setAwsToken(const std::string & token);
104 void setAwsAlternate(const bool &option);
105
106 void setS3Auth(const std::string & secret, const std::string & access,
107 const std::string & region, const std::string & token);
108
109 void parseConfig();
110
112
113 void init();
114
115 bool isMyDird(void* fd);
116
117 void addDird(void* fd);
118
119 void removeDird(void* fd);
120
121 std::vector<std::string> getReplicas()
122 {
123 return replicas;
124 }
125
128
129 std::vector<std::string> replicas;
130
131 // DAVIX
132 Davix::Context *davixContext;
133 Davix::RequestParams *davixParam;
134 Davix::DavPosix *davixPosix;
135 Davix_fd *davixFd;
139 std::vector<void*> dirdVec;
140
141public:
142 Int_t DavixStat(const char *url, struct stat *st);
143
144 static Davix::Context* getDavixInstance();
145};
146
147#endif
const char Option_t
Definition RtypesCore.h:66
Option_t Option_t option
void addDird(void *fd)
Davix::RequestParams * davixParam
bool isMyDird(void *fd)
std::vector< void * > dirdVec
void setAwsToken(const std::string &token)
void setS3Auth(const std::string &secret, const std::string &access, const std::string &region, const std::string &token)
void setAwsAlternate(const bool &option)
static Davix::Context * getDavixInstance()
Davix::DavPosix * davixPosix
TDavixFileInternal(const TUrl &mUrl, Option_t *mopt)
void parseParams(Option_t *option)
intput params
std::vector< std::string > getReplicas()
Int_t DavixStat(const char *url, struct stat *st)
Davix_fd * getDavixFileInstance()
Davix_fd * Open()
Davix::Context * davixContext
void setAwsRegion(const std::string &region)
TDavixFileInternal(const char *url, Option_t *mopt)
std::vector< std::string > replicas
void removeDird(void *fd)
This class represents a WWW compatible URL.
Definition TUrl.h:33
TLine l
Definition textangle.C:4