ROOT
6.16/01
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
Int_t
int Int_t
Definition:
RtypesCore.h:41
Option_t
const char Option_t
Definition:
RtypesCore.h:62
TMutex.h
TUrl.h
Context
Small helper to keep current directory context.
TDavixFileInternal
Definition:
TDavixFileInternal.h:53
TDavixFileInternal::addDird
void addDird(void *fd)
Definition:
TDavixFile.cxx:725
TDavixFileInternal::davixParam
Davix::RequestParams * davixParam
Definition:
TDavixFileInternal.h:133
TDavixFileInternal::isMyDird
bool isMyDird(void *fd)
Definition:
TDavixFile.cxx:716
TDavixFileInternal::dirdVec
std::vector< void * > dirdVec
Definition:
TDavixFileInternal.h:139
TDavixFileInternal::setAwsToken
void setAwsToken(const std::string &token)
Definition:
TDavixFile.cxx:374
TDavixFileInternal::opt
Option_t * opt
Definition:
TDavixFileInternal.h:137
TDavixFileInternal::init
void init()
Definition:
TDavixFile.cxx:503
TDavixFileInternal::setS3Auth
void setS3Auth(const std::string &secret, const std::string &access, const std::string ®ion, const std::string &token)
Definition:
TDavixFile.cxx:385
TDavixFileInternal::~TDavixFileInternal
~TDavixFileInternal()
Definition:
TDavixFile.cxx:231
TDavixFileInternal::setAwsAlternate
void setAwsAlternate(const bool &option)
Definition:
TDavixFile.cxx:380
TDavixFileInternal::getDavixInstance
static Davix::Context * getDavixInstance()
Definition:
TDavixFile.cxx:239
TDavixFileInternal::davixPosix
Davix::DavPosix * davixPosix
Definition:
TDavixFileInternal.h:134
TDavixFileInternal::TDavixFileInternal
TDavixFileInternal(const TUrl &mUrl, Option_t *mopt)
Definition:
TDavixFileInternal.h:58
TDavixFileInternal::davixFd
Davix_fd * davixFd
Definition:
TDavixFileInternal.h:135
TDavixFileInternal::parseParams
void parseParams(Option_t *option)
intput params
Definition:
TDavixFile.cxx:448
TDavixFileInternal::oflags
int oflags
Definition:
TDavixFileInternal.h:138
TDavixFileInternal::getReplicas
std::vector< std::string > getReplicas()
Definition:
TDavixFileInternal.h:121
TDavixFileInternal::DavixStat
Int_t DavixStat(const char *url, struct stat *st)
Definition:
TDavixFile.cxx:516
TDavixFileInternal::getDavixFileInstance
Davix_fd * getDavixFileInstance()
Definition:
TDavixFileInternal.h:84
TDavixFileInternal::Open
Davix_fd * Open()
Definition:
TDavixFile.cxx:252
TDavixFileInternal::davixContext
Davix::Context * davixContext
Definition:
TDavixFileInternal.h:132
TDavixFileInternal::setAwsRegion
void setAwsRegion(const std::string ®ion)
Definition:
TDavixFile.cxx:368
TDavixFileInternal::Close
void Close()
Definition:
TDavixFile.cxx:290
TDavixFileInternal::TDavixFileInternal
TDavixFileInternal(const char *url, Option_t *mopt)
Definition:
TDavixFileInternal.h:70
TDavixFileInternal::enableGridMode
void enableGridMode()
Definition:
TDavixFile.cxx:302
TDavixFileInternal::positionLock
TMutex positionLock
Definition:
TDavixFileInternal.h:126
TDavixFileInternal::fUrl
TUrl fUrl
Definition:
TDavixFileInternal.h:136
TDavixFileInternal::replicas
std::vector< std::string > replicas
Definition:
TDavixFileInternal.h:129
TDavixFileInternal::parseConfig
void parseConfig()
Definition:
TDavixFile.cxx:400
TDavixFileInternal::removeDird
void removeDird(void *fd)
Definition:
TDavixFile.cxx:733
TDavixFileInternal::openLock
TMutex openLock
Definition:
TDavixFileInternal.h:127
TDavixFile
Definition:
TDavixFile.h:66
TDavixSystem
Definition:
TDavixSystem.h:41
TLockGuard
Definition:
TVirtualMutex.h:69
TMutex
Definition:
TMutex.h:30
TUrl
This class represents a WWW compatible URL.
Definition:
TUrl.h:35
Davix
Definition:
TDavixFileInternal.h:44
l
auto * l
Definition:
textangle.C:4