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 "oneapi/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 oneapi::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
size
Write out results.
StorageMaker * getMaker(const std::string &proto) const
int64_t IOOffset
Definition: IOTypes.h:20
unsigned int timeout(void) const
void setReadHint(ReadHint value)
bool check(const std::string &url, IOOffset *size=nullptr) const
double tempMinFree(void) const
void setTimeout(unsigned int timeout)
ReadHint readHint(void) const
TEMPL(T2) struct Divides void
Definition: Factorize.h:24
void setTempDir(const std::string &s, double minFreeSpace)
CacheHint cacheHint(void) const
std::unique_ptr< Storage > open(const std::string &url, int mode=IOFlags::OpenRead) const
bool enableAccounting(bool enabled)
static StorageFactory s_instance
std::string tempDir(void) const
void setCacheHint(CacheHint value)
Definition: value.py:1
oneapi::tbb::concurrent_unordered_map< std::string, std::shared_ptr< StorageMaker > > MakerTable
void stagein(const std::string &url) const
static StorageFactory * getToModify(void)
void setDebugLevel(unsigned int level)
std::unique_ptr< Storage > wrapNonLocalFile(std::unique_ptr< Storage > s, const std::string &proto, const std::string &path, int mode) const
std::string tempPath(void) const
unsigned int debugLevel(void) const