src
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
namespace
edm::storage
{
12
class
LocalStorageMaker
:
public
StorageMaker
{
13
public
:
14
std::unique_ptr<Storage>
open
(
const
std::string
&proto,
15
const
std::string
&
path
,
16
int
mode
,
17
const
AuxSettings
&)
const override
{
18
const
StorageFactory
*
f
=
StorageFactory::get
();
19
StorageFactory::ReadHint
readHint =
f
->readHint();
20
StorageFactory::CacheHint
cacheHint =
f
->cacheHint();
21
22
if
(readHint !=
StorageFactory::READ_HINT_UNBUFFERED
|| cacheHint ==
StorageFactory::CACHE_HINT_STORAGE
)
23
mode
&= ~IOFlags
::OpenUnbuffered
;
24
else
25
mode
|=
IOFlags::OpenUnbuffered
;
26
27
auto
file
= std::make_unique<File>(
path
,
mode
);
28
return
f
->wrapNonLocalFile(
std::move
(
file
), proto,
path
,
mode
);
29
}
30
31
bool
check
(
const
std::string
&
/*proto*/
,
32
const
std::string
&
path
,
33
const
AuxSettings
&,
34
IOOffset
*size =
nullptr
)
const override
{
35
struct
stat
st;
36
if
(
stat
(
path
.c_str(), &st) != 0)
37
return
false
;
38
39
if
(
size
)
40
*
size
= st.st_size;
41
42
return
true
;
43
}
44
};
45
}
// namespace edm::storage
46
47
using namespace
edm::storage
;
48
DEFINE_EDM_PLUGIN
(
StorageMakerFactory
,
LocalStorageMaker
,
"file"
);
findQualityFiles.size
size
Write out results.
Definition:
findQualityFiles.py:443
edm::storage::IOOffset
int64_t IOOffset
Definition:
IOTypes.h:20
edm::storage::IOFlags::OpenUnbuffered
Definition:
IOFlags.h:22
edm::storage::StorageFactory::CACHE_HINT_STORAGE
Definition:
StorageFactory.h:16
stat
edm::storage::StorageMaker::AuxSettings
Definition:
StorageMaker.h:12
castor_dqm_sourceclient_file_cfg.path
path
Definition:
castor_dqm_sourceclient_file_cfg.py:37
edm::storage::LocalStorageMaker::check
bool check(const std::string &, const std::string &path, const AuxSettings &, IOOffset *size=nullptr) const override
Definition:
LocalStorageMaker.cc:31
StorageMakerFactory.h
edm::storage::StorageMaker
Definition:
StorageMaker.h:10
edm::storage::StorageFactory::CacheHint
CacheHint
Definition:
StorageFactory.h:16
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
File.h
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition:
ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
edmplugin::PluginFactory
Definition:
PluginFactory.h:35
edm::storage::StorageFactory::READ_HINT_UNBUFFERED
Definition:
StorageFactory.h:18
edm::storage::StorageFactory
Definition:
StorageFactory.h:14
edm_modernize_messagelogger.stat
stat
Definition:
edm_modernize_messagelogger.py:27
f
double f[11][100]
Definition:
MuScleFitUtils.cc:78
edm::storage::StorageFactory::ReadHint
ReadHint
Definition:
StorageFactory.h:18
geometryDiff.file
file
Definition:
geometryDiff.py:13
edm::storage
Definition:
XMLUtils.h:19
StorageFactory.h
edm::storage::LocalStorageMaker
Definition:
LocalStorageMaker.cc:12
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition:
PluginFactory.h:123
edm::storage::StorageFactory::get
static const StorageFactory * get(void)
Definition:
StorageFactory.cc:30
StorageMaker.h
edm::storage::LocalStorageMaker::open
std::unique_ptr< Storage > open(const std::string &proto, const std::string &path, int mode, const AuxSettings &) const override
Definition:
LocalStorageMaker.cc:14
eostools.move
def move(src, dest)
Definition:
eostools.py:511
Generated for CMSSW Reference Manual by
1.8.14