test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 class Storage;
14 {
15 public:
16  enum CacheHint
17  {
22  };
23 
24  enum ReadHint
25  {
29  };
30 
31  static const StorageFactory *get (void);
32  static StorageFactory *getToModify (void);
33 
34  ~StorageFactory (void);
35 
36  // implicit copy constructor
37  // implicit assignment operator
38 
40  CacheHint cacheHint(void) const;
41 
43  ReadHint readHint(void) const;
44 
45  bool enableAccounting (bool enabled);
46  bool accounting (void) const;
47 
48  void setTimeout(unsigned int timeout);
49  unsigned int timeout(void) const;
50 
51  void setDebugLevel(unsigned int level);
52  unsigned int debugLevel(void) const;
53 
54  void setTempDir (const std::string &s, double minFreeSpace);
55  std::string tempDir (void) const;
56  std::string tempPath (void) const;
57  double tempMinFree (void) const;
58 
59  void stagein (const std::string &url) const;
60  std::unique_ptr<Storage> open (const std::string &url,
61  int mode = IOFlags::OpenRead) const;
62  bool check (const std::string &url,
63  IOOffset *size = 0) const;
64 
65  std::unique_ptr<Storage> wrapNonLocalFile (std::unique_ptr<Storage> s,
66  const std::string &proto,
67  const std::string &path,
68  int mode) const;
69 
70 private:
71  typedef tbb::concurrent_unordered_map<std::string, std::shared_ptr<StorageMaker>> MakerTable;
72 
73  StorageFactory (void);
74  StorageMaker *getMaker (const std::string &proto) const;
76  std::string &protocol,
77  std::string &rest) const;
78 
83  double m_tempfree;
87  unsigned int m_timeout;
88  unsigned int m_debugLevel;
91 };
92 
93 #endif // STORAGE_FACTORY_STORAGE_FACTORY_H
bool check(const std::string &url, IOOffset *size=0) const
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
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
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
tuple level
Definition: testEve_cfg.py:34
MakerTable m_makers
LocalFileSystem m_lfs
tuple size
Write out results.
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