CMS 3D CMS Logo

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