CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/Utilities/StorageFactory/src/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 <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 void
00022 StorageMaker::setDebugLevel (unsigned int /*level*/)
00023 {}
00024 
00025 bool
00026 StorageMaker::check (const std::string &proto,
00027                      const std::string &path,
00028                      IOOffset *size /* = 0 */)
00029 {
00030   // Fallback method is to open the file and check its
00031   // size.  Because grid jobs run in a directory where
00032   // there is usually more space than in /tmp, and that
00033   // directory is automatically cleaned up, open up the
00034   // temporary files in the current directory.  If the
00035   // file is downloaded, it will delete itself in the
00036   // destructor or close method.
00037   bool found = false;
00038   int mode = IOFlags::OpenRead | IOFlags::OpenUnbuffered;
00039   if (Storage *s = open (proto, path, mode))
00040   {
00041     if (size)
00042       *size = s->size ();
00043 
00044     s->close ();
00045     delete s;
00046 
00047     found = true;
00048   }
00049 
00050   return found;
00051 }