Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-10-01 22:41:13

0001 #include "Utilities/StorageFactory/interface/StorageMaker.h"
0002 #include "Utilities/StorageFactory/interface/Storage.h"
0003 #include "Utilities/StorageFactory/interface/IOFlags.h"
0004 #include <cstdlib>
0005 
0006 using namespace edm::storage;
0007 
0008 void StorageMaker::stagein(const std::string & /*proto*/, const std::string & /*path*/, const AuxSettings &) const {}
0009 
0010 bool StorageMaker::check(const std::string &proto,
0011                          const std::string &path,
0012                          const AuxSettings &aux,
0013                          IOOffset *size /* = 0 */) const {
0014   // Fallback method is to open the file and check its
0015   // size.  Because grid jobs run in a directory where
0016   // there is usually more space than in /tmp, and that
0017   // directory is automatically cleaned up, open up the
0018   // temporary files in the current directory.  If the
0019   // file is downloaded, it will delete itself in the
0020   // destructor or close method.
0021   bool found = false;
0022   int mode = IOFlags::OpenRead | IOFlags::OpenUnbuffered;
0023   if (auto s = open(proto, path, mode, aux)) {
0024     if (size)
0025       *size = s->size();
0026 
0027     s->close();
0028 
0029     found = true;
0030   }
0031 
0032   return found;
0033 }