CMS 3D CMS Logo

LocalStorageMaker.cc
Go to the documentation of this file.
1 #define _GNU_SOURCE 1
2 #define _FILE_OFFSET_BITS 64
7 #include <sys/types.h>
8 #include <sys/stat.h>
9 #include <unistd.h>
10 
12 {
13 public:
14  virtual std::unique_ptr<Storage> open (const std::string &proto,
15  const std::string &path,
16  int mode,
17  const AuxSettings&) const override
18  {
20  StorageFactory::ReadHint readHint = f->readHint();
21  StorageFactory::CacheHint cacheHint = f->cacheHint();
22 
24  || cacheHint == StorageFactory::CACHE_HINT_STORAGE)
25  mode &= ~IOFlags::OpenUnbuffered;
26  else
28 
29  auto file = std::make_unique<File> (path, mode);
30  return f->wrapNonLocalFile (std::move(file), proto, path, mode);
31  }
32 
33  virtual bool check (const std::string &/*proto*/,
34  const std::string &path,
35  const AuxSettings&,
36  IOOffset *size = 0) const override
37  {
38  struct stat st;
39  if (stat (path.c_str(), &st) != 0)
40  return false;
41 
42  if (size)
43  *size = st.st_size;
44 
45  return true;
46  }
47 };
48 
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
Definition: IOFlags.h:4
static const StorageFactory * get(void)
double f[11][100]
ReadHint readHint(void) const
int64_t IOOffset
Definition: IOTypes.h:19
virtual std::unique_ptr< Storage > open(const std::string &proto, const std::string &path, int mode, const AuxSettings &) const override
#define DEFINE_EDM_PLUGIN(factory, type, name)
def move(src, dest)
Definition: eostools.py:510
virtual bool check(const std::string &, const std::string &path, const AuxSettings &, IOOffset *size=0) const override