Package scfs.directoryService

Examples of scfs.directoryService.NodeMetadata


    if(path.equals("/.statistics.txt"))
      return 0;

    numOp[3]++;

    NodeMetadata nm = (NodeMetadata) fh;
    if(!config.getIsSync()){
      daS.syncWDisk(nm.getId_path());
    }else{
      daS.syncWClouds(nm.getId_path(), nm.getKey());
    }

    return 0;
  }
View Full Code Here


    numOp[6]++;

    try {
      long time = System.currentTimeMillis();
      NodeMetadata fromMeta = directoryService.getMetadata(from);
      Statistics.incGetMeta(System.currentTimeMillis()-time);
      String[] vec = dividePath(to);
      int nlink = fromMeta.getStats().getNlink()+1;
      fromMeta.getStats().setNlink(nlink);
      NodeMetadata m = new NodeMetadata(fromMeta.getNodeType(), vec[0], vec[1], fromMeta.getStats(), fromMeta.getId_path(), fromMeta.getKey(), null, null);
      time = System.currentTimeMillis();
      directoryService.putMetadata(m);
      Statistics.incPutMeta(System.currentTimeMillis()-time);
      if(nlink>2){
        time = System.currentTimeMillis();
        Collection<NodeMetadata> l = directoryService.getAllLinks(fromMeta.getId_path());
        Statistics.incGetAllLinksMeta(System.currentTimeMillis() - time);
        for(NodeMetadata meta : l){
          FileStats fs = meta.getStats();
          fs.setNlink(nlink);
          NodeMetadata nodeMeta = new NodeMetadata(meta.getNodeType(), meta.getParent(), meta.getName(), fs, meta.getId_path(), meta.getKey(), null, null);
          time = System.currentTimeMillis();
          directoryService.updateMetadata(meta.getPath(), nodeMeta);
          Statistics.incUpdateMeta(System.currentTimeMillis()-time);
        }
      }
View Full Code Here

    numOp[12]++;
    if(path.equals("/.statistics.txt"))
      return 0;

    NodeMetadata nm = ((NodeMetadata)fh);
    daS.cleanMemory(nm.getId_path());


    if(!config.isNonSharing()){
      if (lockedFiles.containsKey(nm.getId_path()) && (flags & SCFSConstants.O_ACCMODE) == O_WRONLY || (flags & SCFSConstants.O_ACCMODE) == O_RDWR) { 
        daS.releaseData(nm.getId_path());
        lockedFiles.remove(nm.getId_path());
      }
    }

    return 0;
  }
View Full Code Here

    numOp[17]++;

    if(path.equals("/.statistics.txt"))
      return 0;

    NodeMetadata metadata = null;

    if(!config.isNonSharing()){
      metadata=this.getMetadata(path);

      try {
        FileStats fs = metadata.getStats();
        fs.setBlocks((int) ((size + 511L) / 512L));
        fs.setSize(size);

        daS.truncData(metadata.getId_path(), (int)size, metadata.getKey(), metadata.getStats().getDataHash(), false, metadata.getStats().isPending());
        NodeMetadata node = new NodeMetadata(metadata.getNodeType(), metadata.getParent(), metadata.getName(), fs, metadata.getId_path(), metadata.getKey(), metadata.getC_r(), metadata.getC_w());
        if(metadata.getStats().isPrivate()){
          namespace.updateMetadata(path, node);
        }else{
          long time = System.currentTimeMillis();
          directoryService.updateMetadata(path, node);
          Statistics.incUpdateMeta(System.currentTimeMillis() - time);
        }

      } catch (DirectoryServiceConnectionProblemException e) {
        throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
      } catch (DirectoryServiceException e) {
        throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
      }

    }else{
      try {
        long time = System.currentTimeMillis();
        metadata = directoryService.getMetadata(path);
        Statistics.incGetMeta(System.currentTimeMillis() - time);

        FileStats fs = metadata.getStats();
        fs.setBlocks((int) ((size + 511L) / 512L));
        fs.setSize(size);

        daS.truncData(metadata.getId_path(), (int)size, metadata.getKey(), metadata.getStats().getDataHash(), false, metadata.getStats().isPending());
        NodeMetadata node = new NodeMetadata(metadata.getNodeType(), metadata.getParent(), metadata.getName(), fs, metadata.getId_path(), metadata.getKey(), metadata.getC_r(), metadata.getC_w());
        time = System.currentTimeMillis();
        directoryService.updateMetadata(path, node);
        Statistics.incUpdateMeta(System.currentTimeMillis() - time);
      } catch (DirectoryServiceException e) {
      }
View Full Code Here

    try {

      String[] vec = dividePath(to);
      FileStats fs = createDefaultFileStats(NodeType.SYMLINK, 0, -1);
      NodeMetadata m = new NodeMetadata(NodeType.SYMLINK, vec[0], vec[1], fs, from, defaultKey, null, null);

      directoryService.putMetadata(m);
    } catch (DirectoryServiceConnectionProblemException e) {
      throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
    } catch (DirectoryServiceException e) {
View Full Code Here

  @Override
  public int readlink(String path, CharBuffer link) throws FuseException {
    Printer.println("\n :::: READLINK(" + path + ", link: " + link + " )", "amarelo");

    numOp[11]++;
    NodeMetadata nm = null;
    try {
      nm = namespace.getMetadata(path);
    } catch (DirectoryServiceConnectionProblemException e) {
      throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
    } catch (DirectoryServiceException e) {
      try {
        long time = System.currentTimeMillis();
        nm = directoryService.getMetadata(path);
        Statistics.incGetMeta(System.currentTimeMillis() - time);
      } catch (DirectoryServiceException e1) {
        throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
      }
    }
    link.put(nm.getId_path());

    return 0;
  }
View Full Code Here

    numOp[18]++;

    if(path.equals("/.statistics.txt"))
      return 0;
    NodeMetadata metadata = null;
    boolean isInPNS = false;
    if(!config.isNonSharing()){
      try {
        metadata = namespace.getMetadata(path);
        isInPNS = true;
      } catch (DirectoryServiceException e1) {
        try {
          long time = System.currentTimeMillis();
          metadata = directoryService.getMetadata(path);
          Statistics.incGetMeta(System.currentTimeMillis() - time);
          isInPNS = false;
        } catch (DirectoryServiceException e) {
          throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
        }
      }
    }else{
      try {
        long time = System.currentTimeMillis();
        metadata = directoryService.getMetadata(path);
        Statistics.incGetMeta(System.currentTimeMillis() - time);
      } catch (DirectoryServiceException e) {
        throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
      }
    }

    if(metadata.getStats().getNlink() == 1)
      daS.deleteData(metadata.getId_path());

    try {
      if(!config.isNonSharing() && isInPNS){
        namespace.removeMetadata(path);
      }else{
View Full Code Here

    Printer.println("\n :::: UTIME(" + path + ", atime: " + atime + ", mtime: " + mtime + " )", "amarelo");
    if(path.equals("/.statistics.txt"))
      return 0;

    NodeMetadata metadata = null;

    if(!config.isNonSharing()){

      metadata = this.getMetadata(path);
    }else{
      try {
        long time = System.currentTimeMillis();
        metadata = directoryService.getMetadata(path);
        Statistics.incGetMeta(System.currentTimeMillis() - time);
      } catch (DirectoryServiceException e) {
        throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
      }
    }

    FileStats fs = metadata.getStats();
    fs.setAtime(atime);
    fs.setMtime(mtime);
    NodeMetadata node = new NodeMetadata(metadata.getNodeType(), metadata.getParent(), metadata.getName(), fs, metadata.getId_path(), metadata.getKey(), metadata.getC_r(), metadata.getC_w());

    try {
      if(!config.isNonSharing() && metadata.getStats().isPrivate()){
        namespace.updateMetadata(path, node);
      }else{
View Full Code Here

    if(path.equals("/.statistics.txt"))
      return 0;

    numOp[1]++;

    NodeMetadata metadata=null;

    if(!config.isNonSharing()){
      metadata = this.getMetadata(path);
    }else{
      try {
        long time = System.currentTimeMillis();
        metadata = directoryService.getMetadata(path);
        Statistics.incGetMeta(System.currentTimeMillis() - time);
      } catch (DirectoryServiceException e) {
        throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
      }
    }

    FileStats fs = metadata.getStats();
    fs.setUid(uid);
    fs.setGid(gid);
    NodeMetadata node = new NodeMetadata(metadata.getNodeType(), metadata.getParent(), metadata.getName(), fs, metadata.getId_path(), metadata.getKey(), metadata.getC_r(), metadata.getC_w());

    try {
      if(!config.isNonSharing() && metadata.getStats().isPrivate()){
        namespace.updateMetadata(path, node);
      }else{
View Full Code Here

  @Override
  public int getxattr(String path, String name, ByteBuffer buf)
      throws FuseException, BufferOverflowException {
    Printer.println("\n :::: GETXATTR(" + path + ", name: " + name + " )", "amarelo");

    NodeMetadata m = null;
    if(!config.isNonSharing()){
      m = this.getMetadata(path);

      byte[] array = m.getStats().getXattr().get(name);
      if(array!=null){
        buf.put(array);
      }

    }
View Full Code Here

TOP

Related Classes of scfs.directoryService.NodeMetadata

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.