CMS 3D CMS Logo

StorageMaker.cc

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

Generated on Tue Jun 9 17:48:54 2009 for CMSSW by  doxygen 1.5.4