CMS 3D CMS Logo

StorageFactory.h
Go to the documentation of this file.
1 #ifndef STORAGE_FACTORY_STORAGE_FACTORY_H
2 #define STORAGE_FACTORY_STORAGE_FACTORY_H
3 
8 #include <string>
9 #include <memory>
10 #include "tbb/concurrent_unordered_map.h"
11 
12 class Storage;
14 public:
16 
18 
19  static const StorageFactory *get(void);
20  static StorageFactory *getToModify(void);
21 
22  ~StorageFactory(void);
23 
24  // implicit copy constructor
25  // implicit assignment operator
26 
28  CacheHint cacheHint(void) const;
29 
31  ReadHint readHint(void) const;
32 
33  bool enableAccounting(bool enabled);
34  bool accounting(void) const;
35 
36  void setTimeout(unsigned int timeout);
37  unsigned int timeout(void) const;
38 
39  void setDebugLevel(unsigned int level);
40  unsigned int debugLevel(void) const;
41 
42  void setTempDir(const std::string &s, double minFreeSpace);
43  std::string tempDir(void) const;
44  std::string tempPath(void) const;
45  double tempMinFree(void) const;
46 
47  void stagein(const std::string &url) const;
48  std::unique_ptr<Storage> open(const std::string &url, int mode = IOFlags::OpenRead) const;
49  bool check(const std::string &url, IOOffset *size = nullptr) const;
50 
51  std::unique_ptr<Storage> wrapNonLocalFile(std::unique_ptr<Storage> s,
52  const std::string &proto,
53  const std::string &path,
54  int mode) const;
55 
56 private:
57  typedef tbb::concurrent_unordered_map<std::string, std::shared_ptr<StorageMaker>> MakerTable;
58 
59  StorageFactory(void);
60  StorageMaker *getMaker(const std::string &proto) const;
61  StorageMaker *getMaker(const std::string &url, std::string &protocol, std::string &rest) const;
62 
67  double m_tempfree;
71  unsigned int m_timeout;
72  unsigned int m_debugLevel;
75 };
76 
77 #endif // STORAGE_FACTORY_STORAGE_FACTORY_H
personalPlayback.level
level
Definition: personalPlayback.py:22
StorageFactory::setCacheHint
void setCacheHint(CacheHint value)
Definition: StorageFactory.cc:40
StorageFactory::tempDir
std::string tempDir(void) const
Definition: StorageFactory.cc:90
relmon_authenticated_wget.url
url
Definition: relmon_authenticated_wget.py:22
StorageFactory::m_lfs
LocalFileSystem m_lfs
Definition: StorageFactory.h:73
StorageFactory::~StorageFactory
~StorageFactory(void)
Definition: StorageFactory.cc:26
StorageFactory::wrapNonLocalFile
std::unique_ptr< Storage > wrapNonLocalFile(std::unique_ptr< Storage > s, const std::string &proto, const std::string &path, int mode) const
Definition: StorageFactory.cc:207
StorageFactory::CacheHint
CacheHint
Definition: StorageFactory.h:15
StorageFactory::READ_HINT_UNBUFFERED
Definition: StorageFactory.h:17
StorageFactory::open
std::unique_ptr< Storage > open(const std::string &url, int mode=IOFlags::OpenRead) const
Definition: StorageFactory.cc:124
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
StorageMaker
Definition: StorageMaker.h:9
StorageFactory::StorageFactory
StorageFactory(void)
Definition: StorageFactory.cc:15
StorageFactory::getToModify
static StorageFactory * getToModify(void)
Definition: StorageFactory.cc:30
StorageFactory::READ_HINT_READAHEAD
Definition: StorageFactory.h:17
StorageFactory::tempPath
std::string tempPath(void) const
Definition: StorageFactory.cc:92
StorageFactory::setReadHint
void setReadHint(ReadHint value)
Definition: StorageFactory.cc:44
StorageFactory::accounting
bool accounting(void) const
Definition: StorageFactory.cc:38
alignCSCRings.s
s
Definition: alignCSCRings.py:92
StorageFactory::m_tempdir
std::string m_tempdir
Definition: StorageFactory.h:69
StorageFactory::CACHE_HINT_LAZY_DOWNLOAD
Definition: StorageFactory.h:15
IOFlags.h
StorageFactory::setDebugLevel
void setDebugLevel(unsigned int level)
Definition: StorageFactory.cc:52
StorageFactory::get
static const StorageFactory * get(void)
Definition: StorageFactory.cc:28
StorageFactory::stagein
void stagein(const std::string &url) const
Definition: StorageFactory.cc:159
IOFlags::OpenRead
Definition: IOFlags.h:7
StorageMaker.h
StorageFactory::READ_HINT_AUTO
Definition: StorageFactory.h:17
StorageFactory::m_debugLevel
unsigned int m_debugLevel
Definition: StorageFactory.h:72
StorageFactory::readHint
ReadHint readHint(void) const
Definition: StorageFactory.cc:46
LocalFileSystem.h
StorageFactory::s_instance
static StorageFactory s_instance
Definition: StorageFactory.h:74
StorageFactory::m_accounting
bool m_accounting
Definition: StorageFactory.h:66
StorageFactory::check
bool check(const std::string &url, IOOffset *size=nullptr) const
Definition: StorageFactory.cc:181
IOOffset
int64_t IOOffset
Definition: IOTypes.h:19
StorageFactory::debugLevel
unsigned int debugLevel(void) const
Definition: StorageFactory.cc:54
value
Definition: value.py:1
StorageFactory::CACHE_HINT_AUTO_DETECT
Definition: StorageFactory.h:15
StorageFactory::m_cacheHint
CacheHint m_cacheHint
Definition: StorageFactory.h:64
IOTypes.h
timeout
Definition: timeout.py:1
StorageFactory
Definition: StorageFactory.h:13
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
StorageFactory::m_timeout
unsigned int m_timeout
Definition: StorageFactory.h:71
StorageFactory::MakerTable
tbb::concurrent_unordered_map< std::string, std::shared_ptr< StorageMaker > > MakerTable
Definition: StorageFactory.h:57
StorageFactory::getMaker
StorageMaker * getMaker(const std::string &proto) const
Definition: StorageFactory.cc:96
mergeAndRegister.rest
rest
Definition: mergeAndRegister.py:120
StorageFactory::cacheHint
CacheHint cacheHint(void) const
Definition: StorageFactory.cc:42
StorageFactory::CACHE_HINT_APPLICATION
Definition: StorageFactory.h:15
StorageFactory::setTimeout
void setTimeout(unsigned int timeout)
Definition: StorageFactory.cc:48
StorageFactory::tempMinFree
double tempMinFree(void) const
Definition: StorageFactory.cc:94
StorageFactory::m_tempfree
double m_tempfree
Definition: StorageFactory.h:67
StorageFactory::enableAccounting
bool enableAccounting(bool enabled)
Definition: StorageFactory.cc:32
StorageFactory::CACHE_HINT_STORAGE
Definition: StorageFactory.h:15
LocalFileSystem
Definition: LocalFileSystem.h:11
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
StorageFactory::m_readHint
ReadHint m_readHint
Definition: StorageFactory.h:65
StorageFactory::ReadHint
ReadHint
Definition: StorageFactory.h:17
StorageFactory::m_makers
MakerTable m_makers
Definition: StorageFactory.h:63
StorageFactory::m_temppath
std::string m_temppath
Definition: StorageFactory.h:68
Storage
Definition: Storage.h:20
StorageFactory::timeout
unsigned int timeout(void) const
Definition: StorageFactory.cc:50
StorageFactory::setTempDir
void setTempDir(const std::string &s, double minFreeSpace)
Definition: StorageFactory.cc:56
StorageFactory::m_unusableDirWarnings
std::string m_unusableDirWarnings
Definition: StorageFactory.h:70
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
pixel_dqm_sourceclient-live_cfg.enabled
enabled
Definition: pixel_dqm_sourceclient-live_cfg.py:139