CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 namespace edm::storage {
13  class Storage;
15  public:
17 
19 
20  static const StorageFactory *get(void);
21  static StorageFactory *getToModify(void);
22 
23  ~StorageFactory(void);
24 
25  // implicit copy constructor
26  // implicit assignment operator
27 
29  CacheHint cacheHint(void) const;
30 
32  ReadHint readHint(void) const;
33 
34  bool enableAccounting(bool enabled);
35  bool accounting(void) const;
36 
37  void setTimeout(unsigned int timeout);
38  unsigned int timeout(void) const;
39 
40  void setDebugLevel(unsigned int level);
41  unsigned int debugLevel(void) const;
42 
43  void setTempDir(const std::string &s, double minFreeSpace);
44  std::string tempDir(void) const;
45  std::string tempPath(void) const;
46  double tempMinFree(void) const;
47 
48  void stagein(const std::string &url) const;
49  std::unique_ptr<Storage> open(const std::string &url, int mode = IOFlags::OpenRead) const;
50  bool check(const std::string &url, IOOffset *size = nullptr) const;
51 
52  std::unique_ptr<Storage> wrapNonLocalFile(std::unique_ptr<Storage> s,
53  const std::string &proto,
54  const std::string &path,
55  int mode) const;
56 
57  private:
58  typedef tbb::concurrent_unordered_map<std::string, std::shared_ptr<StorageMaker>> MakerTable;
59 
60  StorageFactory(void);
61  StorageMaker *getMaker(const std::string &proto) const;
62  StorageMaker *getMaker(const std::string &url, std::string &protocol, std::string &rest) const;
63 
68  double m_tempfree;
72  unsigned int m_timeout;
73  unsigned int m_debugLevel;
76  };
77 } // namespace edm::storage
78 #endif // STORAGE_FACTORY_STORAGE_FACTORY_H
std::string tempDir(void) const
int64_t IOOffset
Definition: IOTypes.h:20
double tempMinFree(void) const
void setReadHint(ReadHint value)
void setTimeout(unsigned int timeout)
ReadHint readHint(void) const
unsigned int debugLevel(void) const
CacheHint cacheHint(void) const
void setTempDir(const std::string &s, double minFreeSpace)
unsigned int timeout(void) const
bool check(const std::string &url, IOOffset *size=nullptr) 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)
static StorageFactory s_instance
StorageMaker * getMaker(const std::string &proto) const
void setCacheHint(CacheHint value)
static StorageFactory * getToModify(void)
bool accounting(void) const
tbb::concurrent_unordered_map< std::string, std::shared_ptr< StorageMaker > > MakerTable
std::unique_ptr< Storage > open(const std::string &url, int mode=IOFlags::OpenRead) const
void setDebugLevel(unsigned int level)
tuple level
Definition: testEve_cfg.py:47
void stagein(const std::string &url) const
tuple size
Write out results.
std::string tempPath(void) const