CMS 3D CMS Logo

DavixStorageMaker.cc
Go to the documentation of this file.
6 #include <davix.hpp>
7 #include <unistd.h>
8 
10 
11 public:
14  std::unique_ptr<Storage> open(const std::string &proto, const std::string &path, int mode,
15  AuxSettings const &aux) const override {
17  std::string newurl((proto == "web" ? "http" : proto) + ":" + path);
18  auto file = std::make_unique<DavixFile>(newurl, mode);
19  return f->wrapNonLocalFile(std::move(file), proto, std::string(), mode);
20  }
21 
22  bool check(const std::string &proto, const std::string &path, const AuxSettings &aux,
23  IOOffset *size = nullptr) const override {
24  std::string newurl((proto == "web" ? "http" : proto) + ":" + path);
25  Davix::DavixError *err = nullptr;
26  Davix::Context c;
27  Davix::DavPosix davixPosix(&c);
28  Davix::StatInfo info;
29  davixPosix.stat64(nullptr, newurl, &info, &err);
30  if (err) {
31  std::unique_ptr<Davix::DavixError> davixErrManaged(err);
32  cms::Exception ex("FileCheckError");
33  ex << "Check failed with error " << err->getErrMsg().c_str() << " and error code"
34  << err->getStatus();
35  ex.addContext("Calling DavixFile::check()");
36  throw ex;
37  }
38  if (size) {
39  *size = info.size;
40  }
41  return true;
42  }
43 };
44 
size
Write out results.
std::unique_ptr< Storage > wrapNonLocalFile(std::unique_ptr< Storage > s, const std::string &proto, const std::string &path, int mode) const
static const TGPicture * info(bool iBackgroundIsBlack)
bool check(const std::string &proto, const std::string &path, const AuxSettings &aux, IOOffset *size=0) const override
static const StorageFactory * get(void)
std::unique_ptr< Storage > open(const std::string &proto, const std::string &path, int mode, AuxSettings const &aux) const override
double f[11][100]
void addContext(std::string const &context)
Definition: Exception.cc:227
int64_t IOOffset
Definition: IOTypes.h:19
#define DEFINE_EDM_PLUGIN(factory, type, name)
def move(src, dest)
Definition: eostools.py:510