Utilities
DavixAdaptor
plugins
DavixStorageMaker.cc
Go to the documentation of this file.
1
#include "
FWCore/Utilities/interface/Exception.h
"
2
#include "
Utilities/DavixAdaptor/interface/DavixFile.h
"
3
#include "
Utilities/StorageFactory/interface/StorageFactory.h
"
4
#include "
Utilities/StorageFactory/interface/StorageMaker.h
"
5
#include "
Utilities/StorageFactory/interface/StorageMakerFactory.h
"
6
#include <davix.hpp>
7
#include <unistd.h>
8
9
class
DavixStorageMaker
:
public
StorageMaker
{
10
public
:
13
std::unique_ptr<Storage>
open
(
const
std::string
&proto,
14
const
std::string
&
path
,
15
int
mode
,
16
AuxSettings
const
&
aux
)
const override
{
17
const
StorageFactory
*
f
=
StorageFactory::get
();
18
std::string
newurl((proto ==
"web"
?
"http"
: proto) +
":"
+
path
);
19
auto
file
= std::make_unique<DavixFile>(newurl,
mode
);
20
return
f
->wrapNonLocalFile(
std::move
(
file
), proto,
std::string
(),
mode
);
21
}
22
23
bool
check
(
const
std::string
&proto,
24
const
std::string
&
path
,
25
const
AuxSettings
&
aux
,
26
IOOffset
*
size
=
nullptr
)
const override
{
27
std::string
newurl((proto ==
"web"
?
"http"
: proto) +
":"
+
path
);
28
Davix::DavixError *
err
=
nullptr
;
29
Davix::Context
c
;
30
Davix::DavPosix davixPosix(&
c
);
31
Davix::StatInfo
info
;
32
davixPosix.stat64(
nullptr
, newurl, &
info
, &
err
);
33
if
(
err
) {
34
std::unique_ptr<Davix::DavixError> davixErrManaged(
err
);
35
cms::Exception
ex(
"FileCheckError"
);
36
ex <<
"Check failed with error "
<<
err
->getErrMsg().c_str() <<
" and error code"
<<
err
->getStatus();
37
ex.
addContext
(
"Calling DavixFile::check()"
);
38
throw
ex;
39
}
40
if
(
size
) {
41
*
size
=
info
.size;
42
}
43
return
true
;
44
}
45
};
46
47
DEFINE_EDM_PLUGIN
(
StorageMakerFactory
,
DavixStorageMaker
,
"http"
);
48
DEFINE_EDM_PLUGIN
(
StorageMakerFactory
,
DavixStorageMaker
,
"https"
);
49
DEFINE_EDM_PLUGIN
(
StorageMakerFactory
,
DavixStorageMaker
,
"web"
);
cms::Exception::addContext
void addContext(std::string const &context)
Definition:
Exception.cc:165
f
double f[11][100]
Definition:
MuScleFitUtils.cc:78
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition:
ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
StorageMaker
Definition:
StorageMaker.h:9
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition:
FWCollectionSummaryWidget.cc:153
StorageFactory::get
static const StorageFactory * get(void)
Definition:
StorageFactory.cc:28
StorageMaker.h
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition:
PluginFactory.h:124
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edmplugin::PluginFactory
Definition:
PluginFactory.h:34
IOOffset
int64_t IOOffset
Definition:
IOTypes.h:19
printConversionInfo.aux
aux
Definition:
printConversionInfo.py:19
StorageFactory.h
FrontierConditions_GlobalTag_cff.file
file
Definition:
FrontierConditions_GlobalTag_cff.py:13
submitPVResolutionJobs.err
err
Definition:
submitPVResolutionJobs.py:85
StorageFactory
Definition:
StorageFactory.h:13
StorageMakerFactory.h
eostools.move
def move(src, dest)
Definition:
eostools.py:511
DavixStorageMaker::check
bool check(const std::string &proto, const std::string &path, const AuxSettings &aux, IOOffset *size=nullptr) const override
Definition:
DavixStorageMaker.cc:23
Exception.h
cms::Exception
Definition:
Exception.h:70
castor_dqm_sourceclient_file_cfg.path
path
Definition:
castor_dqm_sourceclient_file_cfg.py:37
DavixStorageMaker::open
std::unique_ptr< Storage > open(const std::string &proto, const std::string &path, int mode, AuxSettings const &aux) const override
Definition:
DavixStorageMaker.cc:13
DavixFile.h
c
auto & c
Definition:
CAHitNtupletGeneratorKernelsImpl.h:46
StorageMaker::AuxSettings
Definition:
StorageMaker.h:11
DavixStorageMaker
Definition:
DavixStorageMaker.cc:9
findQualityFiles.size
size
Write out results.
Definition:
findQualityFiles.py:443
Generated for CMSSW Reference Manual by
1.8.16