Package scfs.directoryService

Examples of scfs.directoryService.FileStats


      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


    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);
View Full Code Here

      return 0;

    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);
View Full Code Here

      } 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);
View Full Code Here

      } 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);
View Full Code Here

    int rdev = 0;
    int size = 0;
    long blocks = 0;
    int currentTime = (int) (System.currentTimeMillis() / 1000L);
    int atime = currentTime, mtime = currentTime, ctime = currentTime;
    return new FileStats(inode, mode, nlink, uid, gid, rdev, size, blocks, atime, mtime, ctime, emptyHash, nodeType == NodeType.FILE ? true : false, true);
  }
View Full Code Here

    }
    return opsStr.append("\n").toString();
  }

  private boolean privateToPublic(String path, NodeMetadata m, int id) throws DirectoryServiceException {
    FileStats fs = m.getStats();
    fs.setPrivate(false);
    m.setStats(fs);


    if(!arrayContains(m.getC_r(), id)){
      int[] cr = m.getC_r() == null ? new int[1] : Arrays.copyOf(m.getC_r(), m.getC_r().length+1);
View Full Code Here

   */
  private boolean publicToPrivate(String path, NodeMetadata m, int id) throws DirectoryServiceException{
    if(id==clientId)
      return false;

    FileStats fs = m.getStats();
    fs.setPrivate(true);
    m.setStats(fs);
    if(m.getC_r().length>0 && arrayContains(m.getC_r(), id)){
      int[] cr = new int[m.getC_r().length-1];
      for(int i=0; i<cr.length ; i++)
        if(m.getC_r()[i]!=id)
View Full Code Here

    //UPDATE
    System.out.println("\t2 - UPDATE FILES.");
    for(int i = 0 ; i<NUM_IT ; i++) {
      try {
        FileStats fs = mList.get(i).getStats();
        fs.setSize(fs.getSize()+10);
        mList.get(i).setStats(fs);

        start = System.currentTimeMillis();
        dis.updateMetadata(list.get(i), mList.get(i));
        if(i>=NUM_START)
View Full Code Here

    int rdev = 0;
    int size = 0;
    long blocks = 0;
    int currentTime = (int) (System.currentTimeMillis() / 1000L);
    int atime = currentTime, mtime = currentTime, ctime = currentTime;
    return new FileStats(inode, mode, nlink, uid, gid, rdev, size, blocks, atime, mtime, ctime, new byte[20], nodeType == NodeType.FILE ? true : false, true);
  }
View Full Code Here

TOP

Related Classes of scfs.directoryService.FileStats

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.