}
-bool VfsCatalog::accessReplica(const std::string& replica, int mode) throw (DmException)
+bool VfsCatalog::accessReplica(const std::string& rfn, int mode) throw (DmException)
{
std::string path;
+ Replica replica;
+ bool metaAllowed, replicaAllowed;
+
+ try {
+ replica = this->getReplicaByRFN(rfn);
+ if (mode & W_OK) {
+ replicaAllowed = (replica.status == Replica::kBeingPopulated);
+ } else {
+ replicaAllowed = true;
+ }
- path = vfsPathByRFN(replica);
- return this->access(path, mode);
+ path = vfsPathByRFN(rfn);
+ metaAllowed = this->access(path, mode);
+
+ return metaAllowed && replicaAllowed;
+ } catch (DmException& e) {
+ if (e.code() != EACCES) throw;
+ return false;
+ }
}
return replica;
}
-
+
void VfsCatalog::updateReplica(const Replica& replica) throw (DmException)