Utilities
StorageFactory
plugins
LocalStorageMaker.cc
Go to the documentation of this file.
1
#define _GNU_SOURCE 1
2
#define _FILE_OFFSET_BITS 64
3
#include "
Utilities/StorageFactory/interface/StorageMaker.h
"
4
#include "
Utilities/StorageFactory/interface/StorageMakerFactory.h
"
5
#include "
Utilities/StorageFactory/interface/StorageFactory.h
"
6
#include "
Utilities/StorageFactory/interface/File.h
"
7
#include <sys/types.h>
8
#include <sys/stat.h>
9
#include <unistd.h>
10
11
class
LocalStorageMaker
:
public
StorageMaker
{
12
public
:
13
std::unique_ptr<Storage>
open
(
const
std::string
&proto,
14
const
std::string
&
path
,
15
int
mode
,
16
const
AuxSettings
&)
const override
{
17
const
StorageFactory
*
f
=
StorageFactory::get
();
18
StorageFactory::ReadHint
readHint =
f
->readHint();
19
StorageFactory::CacheHint
cacheHint =
f
->cacheHint();
20
21
if
(readHint !=
StorageFactory::READ_HINT_UNBUFFERED
|| cacheHint ==
StorageFactory::CACHE_HINT_STORAGE
)
22
mode
&= ~
IOFlags
::OpenUnbuffered
;
23
else
24
mode
|=
IOFlags::OpenUnbuffered
;
25
26
auto
file
= std::make_unique<File>(
path
,
mode
);
27
return
f
->wrapNonLocalFile(
std::move
(
file
), proto,
path
,
mode
);
28
}
29
30
bool
check
(
const
std::string
&
/*proto*/
,
31
const
std::string
&
path
,
32
const
AuxSettings
&,
33
IOOffset
*
size
=
nullptr
)
const override
{
34
struct
stat
st;
35
if
(
stat
(
path
.c_str(), &st) != 0)
36
return
false
;
37
38
if
(
size
)
39
*
size
= st.st_size;
40
41
return
true
;
42
}
43
};
44
45
DEFINE_EDM_PLUGIN
(
StorageMakerFactory
,
LocalStorageMaker
,
"file"
);
LocalStorageMaker
Definition:
LocalStorageMaker.cc:11
LocalStorageMaker::open
std::unique_ptr< Storage > open(const std::string &proto, const std::string &path, int mode, const AuxSettings &) const override
Definition:
LocalStorageMaker.cc:13
f
double f[11][100]
Definition:
MuScleFitUtils.cc:78
StorageFactory::CacheHint
CacheHint
Definition:
StorageFactory.h:15
StorageFactory::READ_HINT_UNBUFFERED
Definition:
StorageFactory.h:17
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition:
ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
StorageMaker
Definition:
StorageMaker.h:9
hgcalPlots.stat
stat
Definition:
hgcalPlots.py:1119
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
IOFlags
Definition:
IOFlags.h:4
edmplugin::PluginFactory
Definition:
PluginFactory.h:34
IOOffset
int64_t IOOffset
Definition:
IOTypes.h:19
StorageFactory.h
FrontierConditions_GlobalTag_cff.file
file
Definition:
FrontierConditions_GlobalTag_cff.py:13
StorageFactory
Definition:
StorageFactory.h:13
StorageMakerFactory.h
eostools.move
def move(src, dest)
Definition:
eostools.py:511
LocalStorageMaker::check
bool check(const std::string &, const std::string &path, const AuxSettings &, IOOffset *size=nullptr) const override
Definition:
LocalStorageMaker.cc:30
IOFlags::OpenUnbuffered
Definition:
IOFlags.h:20
StorageFactory::CACHE_HINT_STORAGE
Definition:
StorageFactory.h:15
castor_dqm_sourceclient_file_cfg.path
path
Definition:
castor_dqm_sourceclient_file_cfg.py:37
StorageFactory::ReadHint
ReadHint
Definition:
StorageFactory.h:17
StorageMaker::AuxSettings
Definition:
StorageMaker.h:11
File.h
findQualityFiles.size
size
Write out results.
Definition:
findQualityFiles.py:443
Generated for CMSSW Reference Manual by
1.8.16