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 
30  void setReadHint(ReadHint value);
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 
63  mutable MakerTable m_makers;
67  double m_tempfree;
71  unsigned int m_timeout;
72  unsigned int m_debugLevel;
75 };
76 
77 #endif // STORAGE_FACTORY_STORAGE_FACTORY_H
size
Write out results.
CacheHint cacheHint(void) const
std::unique_ptr< Storage > wrapNonLocalFile(std::unique_ptr< Storage > s, const std::string &proto, const std::string &path, int mode) const
bool enableAccounting(bool enabled)
std::string tempPath(void) const
void setTimeout(unsigned int timeout)
std::string m_tempdir
void setReadHint(ReadHint value)
ReadHint m_readHint
unsigned int m_debugLevel
bool check(const std::string &url, IOOffset *size=nullptr) const
double tempMinFree(void) const
StorageMaker * getMaker(const std::string &proto) const
void stagein(const std::string &url) const
std::string tempDir(void) const
unsigned int timeout(void) const
Definition: value.py:1
void setDebugLevel(unsigned int level)
CacheHint m_cacheHint
std::string m_temppath
ReadHint readHint(void) const
int64_t IOOffset
Definition: IOTypes.h:19
bool accounting(void) const
void setTempDir(const std::string &s, double minFreeSpace)
static StorageFactory s_instance
void setCacheHint(CacheHint value)
unsigned int m_timeout
tbb::concurrent_unordered_map< std::string, std::shared_ptr< StorageMaker > > MakerTable
MakerTable m_makers
LocalFileSystem m_lfs
std::string m_unusableDirWarnings
static StorageFactory * getToModify(void)
unsigned int debugLevel(void) const
std::unique_ptr< Storage > open(const std::string &url, int mode=IOFlags::OpenRead) const