Loading...
Searching...
No Matches
XrdCl::HttpFileSystemPlugIn Class Reference

`#include <XrdClHttpFileSystemPlugIn.hh>`

Inheritance diagram for XrdCl::HttpFileSystemPlugIn:
Collaboration diagram for XrdCl::HttpFileSystemPlugIn:

## Public Member Functions

| HttpFileSystemPlugIn (const std::string &url)
virtual | ~HttpFileSystemPlugIn () noexcept
virtual XRootDStatus | DirList (const std::string &path, DirListFlags::Flags flags, ResponseHandler *handler, uint16_t timeout) override
virtual bool | GetProperty (const std::string &name, std::string &value) const override
virtual XRootDStatus | MkDir (const std::string &path, MkDirFlags::Flags flags, Access::Mode mode, ResponseHandler *handler, uint16_t timeout) override
virtual XRootDStatus | Mv (const std::string &source, const std::string &dest, ResponseHandler *handler, uint16_t timeout) override
virtual XRootDStatus | Rm (const std::string &path, ResponseHandler *handler, uint16_t timeout) override
virtual XRootDStatus | RmDir (const std::string &path, ResponseHandler *handler, uint16_t timeout) override
virtual bool | SetProperty (const std::string &name, const std::string &value) override
virtual XRootDStatus | Stat (const std::string &path, ResponseHandler *handler, uint16_t timeout) override
Public Member Functions inherited from XrdCl::FileSystemPlugIn
virtual | ~FileSystemPlugIn ()
| Destructor.
virtual XRootDStatus | ChMod (const std::string &path, Access::Mode mode, ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus | DeepLocate (const std::string &path, OpenFlags::Flags flags, ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus | DelXAttr (const std::string &path, const std::vector< std::string > &attrs, ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus | GetXAttr (const std::string &path, const std::vector< std::string > &attrs, ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus | ListXAttr (const std::string &path, ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus | Locate (const std::string &path, OpenFlags::Flags flags, ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus | Ping (ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus | Prepare (const std::vector< std::string > &fileList, PrepareFlags::Flags flags, uint8_t priority, ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus | Protocol (ResponseHandler *handler, uint16_t timeout=0)
virtual XRootDStatus | Query (QueryCode::Code queryCode, const Buffer &arg, ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus | SendInfo (const std::string &info, ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus | SetXAttr (const std::string &path, const std::vector< xattr_t > &attrs, ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus | StatVFS (const std::string &path, ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus | Truncate (const std::string &path, uint64_t size, ResponseHandler *handler, uint16_t timeout)

## Detailed Description

Definition at line 18 of file XrdClHttpFileSystemPlugIn.hh.

## Constructor & Destructor Documentation

## HttpFileSystemPlugIn()

XrdCl::HttpFileSystemPlugIn::HttpFileSystemPlugIn | ( | const std::string & | url | ) |

Definition at line 24 of file XrdClHttpFileSystemPlugIn.cc.

: url_(url), logger_(DefaultEnv::GetLog()) {
SetUpLogging(logger_);
logger_->Debug(kLogXrdClHttp,
"HttpFileSystemPlugIn constructed with URL: %s.",
url_.GetObfuscatedURL().c_str());
std::string origin = getenv("XRDXROOTD_PROXY")? getenv("XRDXROOTD_PROXY") : "";
if (getenv("DAVIX_DBG_LOGGING_IN_XRD")) {
Davix::setLogScope(DAVIX_LOG_HEADER | DAVIX_LOG_S3 | DAVIX_LOG_BODY | DAVIX_LOG_CHAIN);
Davix::setLogLevel(DAVIX_LOG_DEBUG);
}
if ( origin.empty() || origin.find("=") == 0) {
ctx_ = new Davix::Context();
davix_client_ = new Davix::DavPosix(ctx_);
}
else {
if (root_ctx_ == NULL) {
root_ctx_ = new Davix::Context();
if (getenv("DAVIX_LOAD_GRID_MODULE_IN_XRD"))
root_ctx_->loadModule("grid");
root_davix_client_ = new Davix::DavPosix(root_ctx_);
}
ctx_ = root_ctx_;
davix_client_ = root_davix_client_;
}
}
XrdCl::DefaultEnv::GetLog
static Log * GetLog()
Get default log.
Definition XrdClDefaultEnv.cc:493
XrdCl::root_ctx_
Davix::Context * root_ctx_
Definition XrdClHttpFileSystemPlugIn.cc:21
XrdCl::root_davix_client_
Davix::DavPosix * root_davix_client_
Definition XrdClHttpFileSystemPlugIn.cc:22
XrdCl::SetUpLogging
void SetUpLogging(Log *logger)
Definition XrdClHttpPlugInUtil.cc:15
XrdCl::kLogXrdClHttp
static const uint64_t kLogXrdClHttp
Definition XrdClHttpPlugInUtil.hh:16

References XrdCl::kLogXrdClHttp, XrdCl::root_ctx_, XrdCl::root_davix_client_, and XrdCl::SetUpLogging().

Here is the call graph for this function:

## ~HttpFileSystemPlugIn()

XrdCl::HttpFileSystemPlugIn::~HttpFileSystemPlugIn | ( |  | ) |

virtual noexcept

Definition at line 55 of file XrdClHttpFileSystemPlugIn.cc.

{
int rc = errno;
if (root_ctx_ == NULL) {
delete davix_client_;
delete ctx_;
}
errno = rc;
}

References XrdCl::root_ctx_.

## Member Function Documentation

## DirList()

XRootDStatus XrdCl::HttpFileSystemPlugIn::DirList | ( | const std::string & | path,
|  | DirListFlags::Flags | flags,
|  | ResponseHandler * | handler,
|  | uint16_t | timeout )

override virtual

See also
  XrdCl::FileSystem::DirlList

Reimplemented from XrdCl::FileSystemPlugIn.

Definition at line 162 of file XrdClHttpFileSystemPlugIn.cc.

{
auto url = url_;
url.SetPath(path);
const auto full_path = url.GetLocation();
logger_->Debug(
kLogXrdClHttp,
"HttpFileSystemPlugIn::DirList - path = %s, flags = %d, timeout = %d",
full_path.c_str(), flags, timeout);
const bool details = flags & DirListFlags::Stat;
const bool recursive = flags & DirListFlags::Recursive;
// res == std::pair<DirectoryList*, XRootDStatus>
auto res =
Posix::DirList(*davix_client_, full_path, details, recursive, timeout);
if (res.second.IsError()) {
logger_->Error(kLogXrdClHttp, "Could not list dir: %s, error: %s",
full_path.c_str(), res.second.ToStr().c_str());
return res.second;
}
auto obj = new AnyObject();
obj->Set(res.first);
handler->HandleResponse(new XRootDStatus(), obj);
return XRootDStatus();
}
XrdCl::DirList
DirListImpl< false > DirList
Definition XrdClFileSystemOperations.hh:746
XrdCl::DirListFlags::Stat
@ Stat
Stat each entry.
Definition XrdClFileSystem.hh:158
XrdCl::DirListFlags::Recursive
@ Recursive
Do a recursive listing.
Definition XrdClFileSystem.hh:161

References XrdCl::ResponseHandler::HandleResponse(), XrdCl::kLogXrdClHttp, XrdCl::DirListFlags::Recursive, and XrdCl::DirListFlags::Stat.

Here is the call graph for this function:

## GetProperty()

bool XrdCl::HttpFileSystemPlugIn::GetProperty | ( | const std::string & | name,
|  | std::string & | value ) const

override virtual

See also
  XrdCl::FileSystem::GetProperty

Reimplemented from XrdCl::FileSystemPlugIn.

Definition at line 229 of file XrdClHttpFileSystemPlugIn.cc.

{
const auto p = properties_.find(name);
if (p == std::end(properties_)) {
return false;
}
value = p->second;
return true;
}
XrdCl::value
Response NullRef< Response >::value
Definition XrdClOperationHandlers.hh:128

References XrdCl::NullRef< Response >::value.

## MkDir()

XRootDStatus XrdCl::HttpFileSystemPlugIn::MkDir | ( | const std::string & | path,
|  | MkDirFlags::Flags | flags,
|  | Access::Mode | mode,
|  | ResponseHandler * | handler,
|  | uint16_t | timeout )

override virtual

See also
  XrdCl::FileSystem::MkDir

Reimplemented from XrdCl::FileSystemPlugIn.

Definition at line 118 of file XrdClHttpFileSystemPlugIn.cc.

{
auto url = url_;
url.SetPath(path);
logger_->Debug(
kLogXrdClHttp,
"HttpFileSystemPlugIn::MkDir - path = %s, flags = %d, timeout = %d",
url.GetObfuscatedURL().c_str(), flags, timeout);
auto status = Posix::MkDir(*davix_client_, url.GetURL(), flags, mode, timeout);
if (status.IsError()) {
logger_->Error(kLogXrdClHttp, "MkDir failed: %s", status.ToStr().c_str());
return status;
}
handler->HandleResponse(new XRootDStatus(status), nullptr);
return XRootDStatus();
}
XrdCl::MkDir
MkDirImpl< false > MkDir
Definition XrdClFileSystemOperations.hh:427

References XrdCl::ResponseHandler::HandleResponse(), and XrdCl::kLogXrdClHttp.

Here is the call graph for this function:

## Mv()

XRootDStatus XrdCl::HttpFileSystemPlugIn::Mv | ( | const std::string & | source,
|  | const std::string & | dest,
|  | ResponseHandler * | handler,
|  | uint16_t | timeout )

override virtual

See also
  XrdCl::FileSystem::Mv

Reimplemented from XrdCl::FileSystemPlugIn.

Definition at line 64 of file XrdClHttpFileSystemPlugIn.cc.

{
//const auto full_source_path = url_.GetLocation() + source;
//const auto full_dest_path = url_.GetLocation() + dest;
const auto full_source_path = url_.GetProtocol() + "://"
+ url_.GetHostName() + ":"
+ std::to_string(url_.GetPort())
+ source;
const auto full_dest_path = url_.GetProtocol() + "://"
+ url_.GetHostName() + ":"
+ std::to_string(url_.GetPort())
+ dest;
logger_->Debug(kLogXrdClHttp,
"HttpFileSystemPlugIn::Mv - src = %s, dest = %s, timeout = %d",
full_source_path.c_str(), full_dest_path.c_str(), timeout);
auto status =
Posix::Rename(*davix_client_, full_source_path, full_dest_path, timeout);
if (status.IsError()) {
logger_->Error(kLogXrdClHttp, "Mv failed: %s", status.ToStr().c_str());
return status;
}
handler->HandleResponse(new XRootDStatus(status), nullptr);
return XRootDStatus();
}
Posix::Rename
XRootDStatus Rename(Davix::DavPosix &davix_client, const std::string &source, const std::string &dest, uint16_t timeout)
Definition XrdClHttpPosix.cc:356

References XrdCl::ResponseHandler::HandleResponse(), XrdCl::kLogXrdClHttp, and Posix::Rename().

Here is the call graph for this function:

## Rm()

XRootDStatus XrdCl::HttpFileSystemPlugIn::Rm | ( | const std::string & | path,
|  | ResponseHandler * | handler,
|  | uint16_t | timeout )

override virtual

See also
  XrdCl::FileSystem::Rm

Reimplemented from XrdCl::FileSystemPlugIn.

Definition at line 96 of file XrdClHttpFileSystemPlugIn.cc.

{
auto url = url_;
url.SetPath(path);
logger_->Debug(kLogXrdClHttp,
"HttpFileSystemPlugIn::Rm - path = %s, timeout = %d",
url.GetObfuscatedURL().c_str(), timeout);
auto status = Posix::Unlink(*davix_client_, url.GetURL(), timeout);
if (status.IsError()) {
logger_->Error(kLogXrdClHttp, "Rm failed: %s", status.ToStr().c_str());
return status;
}
handler->HandleResponse(new XRootDStatus(status), nullptr);
return XRootDStatus();
}
Posix::Unlink
XRootDStatus Unlink(Davix::DavPosix &davix_client, const std::string &url, uint16_t timeout)
Definition XrdClHttpPosix.cc:405

References XrdCl::ResponseHandler::HandleResponse(), XrdCl::kLogXrdClHttp, and Posix::Unlink().

Here is the call graph for this function:

## RmDir()

XRootDStatus XrdCl::HttpFileSystemPlugIn::RmDir | ( | const std::string & | path,
|  | ResponseHandler * | handler,
|  | uint16_t | timeout )

override virtual

See also
  XrdCl::FileSystem::RmDir

Reimplemented from XrdCl::FileSystemPlugIn.

Definition at line 142 of file XrdClHttpFileSystemPlugIn.cc.

{
auto url = url_;
url.SetPath(path);
logger_->Debug(kLogXrdClHttp,
"HttpFileSystemPlugIn::RmDir - path = %s, timeout = %d",
url.GetObfuscatedURL().c_str(), timeout);
auto status = Posix::RmDir(*davix_client_, url.GetURL(), timeout);
if (status.IsError()) {
logger_->Error(kLogXrdClHttp, "RmDir failed: %s", status.ToStr().c_str());
return status;
}
handler->HandleResponse(new XRootDStatus(status), nullptr);
return XRootDStatus();
}
XrdCl::RmDir
RmDirImpl< false > RmDir
Definition XrdClFileSystemOperations.hh:473

References XrdCl::ResponseHandler::HandleResponse(), and XrdCl::kLogXrdClHttp.

Here is the call graph for this function:

## SetProperty()

bool XrdCl::HttpFileSystemPlugIn::SetProperty | ( | const std::string & | name,
|  | const std::string & | value )

override virtual

See also
  XrdCl::FileSystem::SetProperty

Reimplemented from XrdCl::FileSystemPlugIn.

Definition at line 223 of file XrdClHttpFileSystemPlugIn.cc.

{
properties_[name] = value;
return true;
}

References XrdCl::NullRef< Response >::value.

## Stat()

XRootDStatus XrdCl::HttpFileSystemPlugIn::Stat | ( | const std::string & | path,
|  | ResponseHandler * | handler,
|  | uint16_t | timeout )

override virtual

See also
  XrdCl::FileSystem::Stat

Reimplemented from XrdCl::FileSystemPlugIn.

Definition at line 194 of file XrdClHttpFileSystemPlugIn.cc.

{
//const auto full_path = url_.GetLocation() + path;
const auto full_path = url_.GetProtocol() + "://" +
url_.GetHostName() + ":" +
std::to_string(url_.GetPort()) + "/" + path;
logger_->Debug(kLogXrdClHttp,
"HttpFileSystemPlugIn::Stat - path = %s, timeout = %d",
full_path.c_str(), timeout);
auto stat_info = new StatInfo();
//XRootDStatus status;
auto status = Posix::Stat(*davix_client_, full_path, timeout, stat_info);
if (status.IsError()) {
logger_->Error(kLogXrdClHttp, "Stat failed: %s", status.ToStr().c_str());
return status;
}
auto obj = new AnyObject();
obj->Set(stat_info);
handler->HandleResponse(new XRootDStatus(), obj);
return XRootDStatus();
}
XrdCl::Stat
StatImpl< false > Stat(Ctx< File > file, Arg< bool > force, uint16_t timeout=0)
Definition XrdClFileOperations.hh:535

References XrdCl::ResponseHandler::HandleResponse(), XrdCl::kLogXrdClHttp, and XrdCl::Stat().

Here is the call graph for this function:

The documentation for this class was generated from the following files:

- XrdClHttpFileSystemPlugIn.hh
- XrdClHttpFileSystemPlugIn.cc