CMS 3D CMS Logo

StorageMaker.cc
Go to the documentation of this file.
4 #include <cstdlib>
5 
6 using namespace edm::storage;
7 
8 void StorageMaker::stagein(const std::string & /*proto*/, const std::string & /*path*/, const AuxSettings &) const {}
9 
10 bool StorageMaker::check(const std::string &proto,
11  const std::string &path,
12  const AuxSettings &aux,
13  IOOffset *size /* = 0 */) const {
14  // Fallback method is to open the file and check its
15  // size. Because grid jobs run in a directory where
16  // there is usually more space than in /tmp, and that
17  // directory is automatically cleaned up, open up the
18  // temporary files in the current directory. If the
19  // file is downloaded, it will delete itself in the
20  // destructor or close method.
21  bool found = false;
23  if (auto s = open(proto, path, mode, aux)) {
24  if (size)
25  *size = s->size();
26 
27  s->close();
28 
29  found = true;
30  }
31 
32  return found;
33 }
int64_t IOOffset
Definition: IOTypes.h:20
virtual std::unique_ptr< Storage > open(const std::string &proto, const std::string &path, int mode, const AuxSettings &aux) const =0
virtual void stagein(const std::string &proto, const std::string &path, const AuxSettings &aux) const
Definition: StorageMaker.cc:8
virtual bool check(const std::string &proto, const std::string &path, const AuxSettings &aux, IOOffset *size=nullptr) const
Definition: StorageMaker.cc:10