CMS 3D CMS Logo

Public Member Functions

XrdStorageMaker Class Reference

Inheritance diagram for XrdStorageMaker:
StorageMaker

List of all members.

Public Member Functions

virtual bool check (const std::string &proto, const std::string &path, IOOffset *size=0)
virtual Storageopen (const std::string &proto, const std::string &path, int mode)
virtual void stagein (const std::string &proto, const std::string &path)

Detailed Description

Definition at line 7 of file XrdStorageMaker.cc.


Member Function Documentation

virtual bool XrdStorageMaker::check ( const std::string &  proto,
const std::string &  path,
IOOffset size = 0 
) [inline, virtual]

Reimplemented from StorageMaker.

Definition at line 32 of file XrdStorageMaker.cc.

References flags, and findQualityFiles::size.

  {
    std::string fullpath(proto + ":" + path);
    XrdClientAdmin admin(fullpath.c_str());
    if (! admin.Connect())
      return false; // FIXME: Throw?

    long      id;
    long      flags;
    long      modtime;
    long long xrdsize;

    XrdOucString str(fullpath.c_str());
    XrdClientUrlSet url(str);

    if (! admin.Stat(url.GetFile().c_str(), id, xrdsize, flags, modtime))
      return false; // FIXME: Throw?

    *size = xrdsize;
    return true;
  }
virtual Storage* XrdStorageMaker::open ( const std::string &  proto,
const std::string &  path,
int  mode 
) [inline, virtual]

Open a storage object for the given URL (protocol + path), using the mode bits. No temporary files are downloaded.

Implements StorageMaker.

Definition at line 12 of file XrdStorageMaker.cc.

  {
    std::string fullpath(proto + ":" + path);
    return new XrdFile (fullpath, mode);
  }
virtual void XrdStorageMaker::stagein ( const std::string &  proto,
const std::string &  path 
) [inline, virtual]

Reimplemented from StorageMaker.

Definition at line 20 of file XrdStorageMaker.cc.

  {
    std::string fullpath(proto + ":" + path);
    XrdClientAdmin admin(fullpath.c_str());
    if (admin.Connect())
    {
      XrdOucString str(fullpath.c_str());
      XrdClientUrlSet url(str);
      admin.Prepare(url.GetFile().c_str(), kXR_stage | kXR_noerrs, 0);
    }
  }