ROOT
6.14/05
Reference Guide
net
davix
src
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
44
namespace
Davix
{
45
class
Context
;
46
class
RequestParams;
47
class
DavPosix;
48
class
DavFile;
49
}
50
struct
Davix_fd;
51
52
53
class
TDavixFileInternal
{
54
friend
class
TDavixFile
;
55
friend
class
TDavixSystem
;
56
57
private
:
58
TDavixFileInternal
(
const
TUrl
& mUrl,
Option_t
* mopt) :
59
positionLock(),
60
openLock(),
61
davixContext(getDavixInstance()),
62
davixParam(NULL),
63
davixPosix(NULL),
64
davixFd(NULL),
65
fUrl(mUrl),
66
opt(mopt),
67
oflags(0),
68
dirdVec() { }
69
70
TDavixFileInternal
(
const
char
* url,
Option_t
* mopt) :
71
positionLock(),
72
openLock(),
73
davixContext(getDavixInstance()),
74
davixParam(NULL),
75
davixPosix(NULL),
76
davixFd(NULL),
77
fUrl(url),
78
opt(mopt),
79
oflags(0),
80
dirdVec() { }
81
82
~
TDavixFileInternal
();
83
84
Davix_fd *
getDavixFileInstance
()
85
{
86
// singleton init
87
if
(davixFd == NULL) {
88
TLockGuard
l
(&(openLock));
89
if
(davixFd == NULL) {
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
111
void
parseParams(
Option_t
* option);
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
126
TMutex
positionLock
;
127
TMutex
openLock
;
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
;
136
TUrl
fUrl
;
137
Option_t
*
opt
;
138
int
oflags
;
139
std::vector<void*>
dirdVec
;
140
141
public
:
142
Int_t
DavixStat(
const
char
*url,
struct
stat *st);
143
144
static
Davix::Context* getDavixInstance();
145
};
146
147
#endif
Davix
Definition:
TDavixFileInternal.h:44
TDavixFileInternal
Definition:
TDavixFileInternal.h:53
TMutex
Definition:
TMutex.h:30
TDavixFileInternal::TDavixFileInternal
TDavixFileInternal(const char *url, Option_t *mopt)
Definition:
TDavixFileInternal.h:70
Option_t
const char Option_t
Definition:
RtypesCore.h:62
TUrl
This class represents a WWW compatible URL.
Definition:
TUrl.h:35
TDavixFileInternal::davixParam
Davix::RequestParams * davixParam
Definition:
TDavixFileInternal.h:133
TDavixFileInternal::oflags
int oflags
Definition:
TDavixFileInternal.h:138
Context
Small helper to keep current directory context.
Int_t
int Int_t
Definition:
RtypesCore.h:41
TDavixFileInternal::getDavixFileInstance
Davix_fd * getDavixFileInstance()
Definition:
TDavixFileInternal.h:84
TLockGuard
Definition:
TVirtualMutex.h:69
TDavixFileInternal::davixPosix
Davix::DavPosix * davixPosix
Definition:
TDavixFileInternal.h:134
TDavixFileInternal::positionLock
TMutex positionLock
Definition:
TDavixFileInternal.h:126
TDavixFileInternal::TDavixFileInternal
TDavixFileInternal(const TUrl &mUrl, Option_t *mopt)
Definition:
TDavixFileInternal.h:58
TDavixFileInternal::getReplicas
std::vector< std::string > getReplicas()
Definition:
TDavixFileInternal.h:121
TUrl.h
TMutex.h
TDavixFileInternal::dirdVec
std::vector< void * > dirdVec
Definition:
TDavixFileInternal.h:139
TDavixFileInternal::davixFd
Davix_fd * davixFd
Definition:
TDavixFileInternal.h:135
init
static Int_t init()
Definition:
RooClassFactory.cxx:52
TDavixFileInternal::opt
Option_t * opt
Definition:
TDavixFileInternal.h:137
TDavixSystem
Definition:
TDavixSystem.h:41
l
auto * l
Definition:
textangle.C:4
TDavixFileInternal::openLock
TMutex openLock
Definition:
TDavixFileInternal.h:127
TDavixFileInternal::replicas
std::vector< std::string > replicas
Definition:
TDavixFileInternal.h:129
TDavixFile
Definition:
TDavixFile.h:66
TDavixFileInternal::davixContext
Davix::Context * davixContext
Definition:
TDavixFileInternal.h:132
TDavixFileInternal::fUrl
TUrl fUrl
Definition:
TDavixFileInternal.h:136