bool VfsPoolHandler::poolIsAvailable(bool write = true) throw (DmException)
{
- return !write;
+ return true;
}
bool VfsPoolHandler::replicaIsAvailable(const Replica& replica) throw (DmException)
{
struct stat fstat;
-
- return stat(getLocalPath(replica.rfn).c_str(), &fstat) == 0;
+ Url rloc(replica.rfn);
+
+ debug("replica.rfn='%s'", replica.rfn.c_str());
+ return stat(getLocalPath(rloc.path).c_str(), &fstat) == 0;
}
{
struct stat fstat;
std::string path;
+ Url rloc(replica.rfn);
+ Chunk single;
- if (replica.rfn.empty() || replica.rfn[0] != '/') path = "/" + replica.rfn;
- else path = replica.rfn;
+ if (rloc.path.empty() || rloc.path[0] != '/') path = "/" + rloc.path;
+ else path = rloc.path;
+ debug("replica.rfn='%s'", replica.rfn.c_str());
wrapCall(stat(getLocalPath(path).c_str(), &fstat), "could not find '%s'", path.c_str());
- Url rloc(path);
-
- Chunk single;
-
- single.url.domain = this->driver_->hostName_;
- single.url.path = "/vfs" + rloc.path;
+ single.url.domain = this->driver_->hostName_; // TODO: from rloc.domain
+ single.url.path = "/vfs" + path;
single.offset = 0;
single.size = fstat.st_size;
void VfsPoolHandler::doneWriting(const Location& loc) throw (DmException)
{
+ debug("%s:%s", loc[0].url.domain.c_str(), loc[0].url.path.c_str());
}
// PoolHandler* handler = this->stack_->getPoolDriver(pool.type)->createPoolHandler(pool.name);
// if (handler->replicaIsAvailable(replicas[i])) ...
// ...
+
+#if 0
+ std::vector<Replica> replicas;
+ Pool pool;
+ size_t i;
+
+ replicas = this->stack_->getCatalog()->getReplicas(path);
+ pool = this->getPool("vfs");
+ handler = this->stack_->getPoolDriver(pool.type)->createPoolHandler(pool.name);
+ for (i = 0; i < replicas.size(); i++) {
+ if (replicas[i].getString("pool") != std::string("vfs")) continue;
+ if (handler->replicaIsAvailable(replicas[i])) {
+ location = handler->whereToRead(replicas[i]);
+ }
+ }
+#endif
+
//
// We create a stub replica instead.
//