コード例 #1
0
  @Override
  public void startRequest(MRCRequest rq) throws Throwable {

    final removexattrRequest rqArgs = (removexattrRequest) rq.getRequestArgs();

    final VolumeManager vMan = master.getVolumeManager();
    final FileAccessManager faMan = master.getFileAccessManager();

    Path p = new Path(rqArgs.getVolumeName(), rqArgs.getPath());

    validateContext(rq);

    StorageManager sMan = vMan.getStorageManagerByName(p.getComp(0));
    PathResolver res = new PathResolver(sMan, p);

    // check whether the path prefix is searchable
    faMan.checkSearchPermission(
        sMan, res, rq.getDetails().userId, rq.getDetails().superUser, rq.getDetails().groupIds);

    // check whether file exists
    res.checkIfFileDoesNotExist();

    // retrieve and prepare the metadata to return
    FileMetadata file = res.getFile();

    AtomicDBUpdate update = sMan.createAtomicDBUpdate(master, rq);

    // if the attribute is a system attribute, set it

    final String attrKey = rqArgs.getName();

    // set a system attribute
    if (attrKey.startsWith("xtreemfs.")) {

      // check whether the user has privileged permissions to set
      // system attributes
      faMan.checkPrivilegedPermissions(
          sMan, file, rq.getDetails().userId, rq.getDetails().superUser, rq.getDetails().groupIds);

      MRCHelper.setSysAttrValue(
          sMan, vMan, faMan, res.getParentDirId(), file, attrKey.substring(9), "", update);
    }

    // set a user attribute
    else {

      sMan.setXAttr(file.getId(), rq.getDetails().userId, attrKey, null, update);
    }

    // update POSIX timestamps
    int time = (int) (TimeSync.getGlobalTime() / 1000);
    MRCHelper.updateFileTimes(res.getParentDirId(), file, false, true, false, sMan, time, update);

    // set the response
    rq.setResponse(timestampResponse.newBuilder().setTimestampS(time).build());

    update.execute();
  }
コード例 #2
0
  @Override
  public void startRequest(MRCRequest rq) throws Throwable {

    final statvfsRequest rqArgs = (statvfsRequest) rq.getRequestArgs();

    final VolumeManager vMan = master.getVolumeManager();
    final StorageManager sMan = vMan.getStorageManagerByName(rqArgs.getVolumeName());

    StatVFS volumeInfo = getVolumeInfo(master, sMan);
    // long knownEtag = rqArgs.getKnownEtag();

    // StatVFSSet set = new StatVFSSet();
    // if (knownEtag != volumeInfo.getEtag())
    // set.add(volumeInfo);

    // set the response
    rq.setResponse(volumeInfo);
    finishRequest(rq);
  }