CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
XrdStorageMaker.cc
Go to the documentation of this file.
4 #include "XrdClient/XrdClientAdmin.hh"
5 #include "XrdClient/XrdClientUrlSet.hh"
6 
8 {
9 public:
12  virtual Storage *open (const std::string &proto,
13  const std::string &path,
14  int mode)
15  {
16  std::string fullpath(proto + ":" + path);
17  return new XrdFile (fullpath, mode);
18  }
19 
20  virtual void stagein (const std::string &proto, const std::string &path)
21  {
22  std::string fullpath(proto + ":" + path);
23  XrdClientAdmin admin(fullpath.c_str());
24  if (admin.Connect())
25  {
26  XrdOucString str(fullpath.c_str());
27  XrdClientUrlSet url(str);
28  admin.Prepare(url.GetFile().c_str(), kXR_stage | kXR_noerrs, 0);
29  }
30  }
31 
32  virtual bool check (const std::string &proto,
33  const std::string &path,
34  IOOffset *size = 0)
35  {
36  std::string fullpath(proto + ":" + path);
37  XrdClientAdmin admin(fullpath.c_str());
38  if (! admin.Connect())
39  return false; // FIXME: Throw?
40 
41  long id;
42  long flags;
43  long modtime;
44  long long xrdsize;
45 
46  XrdOucString str(fullpath.c_str());
47  XrdClientUrlSet url(str);
48 
49  if (! admin.Stat(url.GetFile().c_str(), id, xrdsize, flags, modtime))
50  return false; // FIXME: Throw?
51 
52  *size = xrdsize;
53  return true;
54  }
55 };
56 
virtual Storage * open(const std::string &proto, const std::string &path, int mode)
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
Definition: Storage.h:8
int path() const
Definition: HLTadd.h:3
int mode
Definition: AMPTWrapper.h:139
int64_t IOOffset
Definition: IOTypes.h:19
virtual bool check(const std::string &proto, const std::string &path, IOOffset *size=0)
virtual void stagein(const std::string &proto, const std::string &path)
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: XrdFile.h:9
tuple size
Write out results.