00001 #include "Utilities/StorageFactory/interface/StorageMaker.h" 00002 #include "Utilities/StorageFactory/interface/Storage.h" 00003 #include "Utilities/StorageFactory/interface/IOFlags.h" 00004 #include <cstdlib> 00005 00006 StorageMaker::StorageMaker (void) 00007 {} 00008 00009 StorageMaker::~StorageMaker (void) 00010 {} 00011 00012 void 00013 StorageMaker::stagein (const std::string &proto, 00014 const std::string &path) 00015 {} 00016 00017 void 00018 StorageMaker::setTimeout (unsigned int timeout) 00019 {} 00020 00021 bool 00022 StorageMaker::check (const std::string &proto, 00023 const std::string &path, 00024 IOOffset *size /* = 0 */) 00025 { 00026 // Fallback method is to open the file and check its 00027 // size. Because grid jobs run in a directory where 00028 // there is usually more space than in /tmp, and that 00029 // directory is automatically cleaned up, open up the 00030 // temporary files in the current directory. If the 00031 // file is downloaded, it will delete itself in the 00032 // destructor or close method. 00033 bool found = false; 00034 int mode = IOFlags::OpenRead | IOFlags::OpenUnbuffered; 00035 if (Storage *s = open (proto, path, mode)) 00036 { 00037 if (size) 00038 *size = s->size (); 00039 00040 s->close (); 00041 delete s; 00042 00043 found = true; 00044 } 00045 00046 return found; 00047 }