12 #include "shift/stager_api.h"
23 size_t suffix = path.find(
"?");
24 if (suffix == std::string::npos)
28 if (path.find (
":") == std::string::npos)
30 size_t e = path.find_first_not_of (
"/");
31 if (e != std::string::npos)
33 size_t c = path.find(
"/castor/");
34 if ((c != std::string::npos) && (c == e-1))
38 prefix =
"rfio:///?path=";
42 c = path.find(
"/dpm/");
43 if ((c != std::string::npos) && (c == e-1))
56 prefix = path.substr(0, suffix);
57 size_t h = prefix.find_first_not_of(
'/');
58 size_t s = prefix.find_last_not_of(
'/');
60 prefix.replace(0,h,
"rfio://");
64 return prefix + path.substr(suffix);
87 <<
"SiteLocalConfig Failed: SiteLocalConfigService is not loaded yet."
88 <<
"Will use default 'castor' RFIO implementation.";
94 putenv(const_cast<char *>(
"RFIO_TCP_NODELAY=1"));
122 size_t castor = npath.find(
"?path=/castor/");
123 size_t rest = npath.find(
"&");
124 if (proto !=
"rfio" || castor == std::string::npos)
128 size_t len = (rest == std::string::npos ? rest : rest-castor);
132 opts.stage_host = getenv(
"STAGE_HOST");
133 opts.service_class = getenv(
"STAGE_SVCCLASS");
135 opts.stage_version = 2;
137 stage_prepareToGet_filereq req;
138 req.protocol = (
char *)
"rfio";
139 req.filename = (
char *) stagepath.c_str();
143 stage_prepareToGet_fileresp *resp = 0;
144 int rc = stage_prepareToGet(0, &req, 1, &resp, &nresp, 0, &opts);
147 ex <<
"Error while staging in '" << stagepath
149 <<
" (serrno=" <<
serrno <<
")";
150 ex.
addContext(
"Calling RFIOStorageMaker::stagein()");
154 if (nresp == 1 && resp->errorCode != 0) {
156 ex <<
"Error while staging in '" << stagepath
157 <<
"', stagein error was: " << resp->errorMessage
158 <<
" (code=" << resp->errorCode <<
")";
159 ex.
addContext(
"Calling RFIOStorageMaker::stagein()");
163 free(resp->filename);
164 free(resp->errorMessage);
CacheHint cacheHint(void) const
Storage * wrapNonLocalFile(Storage *s, const std::string &proto, const std::string &path, int mode)
static StorageFactory * get(void)
virtual bool check(const std::string &, const std::string &path, IOOffset *size=0) override
tuple path
else: Piece not in the list, fine.
int rfio_access(const char *filepath, int mode)
virtual Storage * open(const std::string &proto, const std::string &path, int mode) override
std::string normalise(const std::string &path)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
virtual void stagein(const std::string &proto, const std::string &path) override
ReadHint readHint(void) const
void addContext(std::string const &context)
#define DEFINE_EDM_PLUGIN(factory, type, name)
virtual std::string const rfioType(void) const =0
int rfio_stat64(const char *path, struct stat *statbuf)
tuple size
Write out results.
T get(const Candidate &c)