Java 类org.apache.hadoop.hdfs.server.namenode.INodeAttributes 实例源码

项目:hadoop    文件:SnapshotFSImageFormat.java   
/**
 * Save SnapshotDiff list for an INodeDirectoryWithSnapshot.
 * @param sNode The directory that the SnapshotDiff list belongs to.
 * @param out The {@link DataOutput} to write.
 */
private static <N extends INode, A extends INodeAttributes, D extends AbstractINodeDiff<N, A, D>>
    void saveINodeDiffs(final AbstractINodeDiffList<N, A, D> diffs,
    final DataOutput out, ReferenceMap referenceMap) throws IOException {
  // Record the diffs in reversed order, so that we can find the correct
  // reference for INodes in the created list when loading the FSImage
  if (diffs == null) {
    out.writeInt(-1); // no diffs
  } else {
    final List<D> list = diffs.asList();
    final int size = list.size();
    out.writeInt(size);
    for (int i = size - 1; i >= 0; i--) {
      list.get(i).write(out, referenceMap);
    }
  }
}
项目:aliyun-oss-hadoop-fs    文件:SnapshotFSImageFormat.java   
/**
 * Save SnapshotDiff list for an INodeDirectoryWithSnapshot.
 * @param sNode The directory that the SnapshotDiff list belongs to.
 * @param out The {@link DataOutput} to write.
 */
private static <N extends INode, A extends INodeAttributes, D extends AbstractINodeDiff<N, A, D>>
    void saveINodeDiffs(final AbstractINodeDiffList<N, A, D> diffs,
    final DataOutput out, ReferenceMap referenceMap) throws IOException {
  // Record the diffs in reversed order, so that we can find the correct
  // reference for INodes in the created list when loading the FSImage
  if (diffs == null) {
    out.writeInt(-1); // no diffs
  } else {
    final List<D> list = diffs.asList();
    final int size = list.size();
    out.writeInt(size);
    for (int i = size - 1; i >= 0; i--) {
      list.get(i).write(out, referenceMap);
    }
  }
}
项目:big-c    文件:SnapshotFSImageFormat.java   
/**
 * Save SnapshotDiff list for an INodeDirectoryWithSnapshot.
 * @param sNode The directory that the SnapshotDiff list belongs to.
 * @param out The {@link DataOutput} to write.
 */
private static <N extends INode, A extends INodeAttributes, D extends AbstractINodeDiff<N, A, D>>
    void saveINodeDiffs(final AbstractINodeDiffList<N, A, D> diffs,
    final DataOutput out, ReferenceMap referenceMap) throws IOException {
  // Record the diffs in reversed order, so that we can find the correct
  // reference for INodes in the created list when loading the FSImage
  if (diffs == null) {
    out.writeInt(-1); // no diffs
  } else {
    final List<D> list = diffs.asList();
    final int size = list.size();
    out.writeInt(size);
    for (int i = size - 1; i >= 0; i--) {
      list.get(i).write(out, referenceMap);
    }
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:SnapshotFSImageFormat.java   
/**
 * Save SnapshotDiff list for an INodeDirectoryWithSnapshot.
 * @param sNode The directory that the SnapshotDiff list belongs to.
 * @param out The {@link DataOutput} to write.
 */
private static <N extends INode, A extends INodeAttributes, D extends AbstractINodeDiff<N, A, D>>
    void saveINodeDiffs(final AbstractINodeDiffList<N, A, D> diffs,
    final DataOutput out, ReferenceMap referenceMap) throws IOException {
  // Record the diffs in reversed order, so that we can find the correct
  // reference for INodes in the created list when loading the FSImage
  if (diffs == null) {
    out.writeInt(-1); // no diffs
  } else {
    final List<D> list = diffs.asList();
    final int size = list.size();
    out.writeInt(size);
    for (int i = size - 1; i >= 0; i--) {
      list.get(i).write(out, referenceMap);
    }
  }
}
项目:hadoop-plus    文件:SnapshotFSImageFormat.java   
/**
 * Save SnapshotDiff list for an INodeDirectoryWithSnapshot.
 * @param sNode The directory that the SnapshotDiff list belongs to.
 * @param out The {@link DataOutput} to write.
 */
private static <N extends INode, A extends INodeAttributes, D extends AbstractINodeDiff<N, A, D>>
    void saveINodeDiffs(final AbstractINodeDiffList<N, A, D> diffs,
    final DataOutput out, ReferenceMap referenceMap) throws IOException {
  // Record the diffs in reversed order, so that we can find the correct
  // reference for INodes in the created list when loading the FSImage
  if (diffs == null) {
    out.writeInt(-1); // no diffs
  } else {
    final List<D> list = diffs.asList();
    final int size = list.size();
    out.writeInt(size);
    for (int i = size - 1; i >= 0; i--) {
      list.get(i).write(out, referenceMap);
    }
  }
}
项目:FlexMap    文件:SnapshotFSImageFormat.java   
/**
 * Save SnapshotDiff list for an INodeDirectoryWithSnapshot.
 * @param sNode The directory that the SnapshotDiff list belongs to.
 * @param out The {@link DataOutput} to write.
 */
private static <N extends INode, A extends INodeAttributes, D extends AbstractINodeDiff<N, A, D>>
    void saveINodeDiffs(final AbstractINodeDiffList<N, A, D> diffs,
    final DataOutput out, ReferenceMap referenceMap) throws IOException {
  // Record the diffs in reversed order, so that we can find the correct
  // reference for INodes in the created list when loading the FSImage
  if (diffs == null) {
    out.writeInt(-1); // no diffs
  } else {
    final List<D> list = diffs.asList();
    final int size = list.size();
    out.writeInt(size);
    for (int i = size - 1; i >= 0; i--) {
      list.get(i).write(out, referenceMap);
    }
  }
}
项目:hops    文件:INodeAttributesContext.java   
private Collection<INodeAttributes> findByPrimaryKeys(
    INodeAttributes.Finder qfinder, Object[] params)
    throws StorageCallPreventedException, StorageException {
  final List<INodeCandidatePrimaryKey> inodePks =
      (List<INodeCandidatePrimaryKey>) params[0];
  Collection<INodeAttributes> result = null;
  if (contains(inodePks)) {
    result = get(inodePks);
    hit(qfinder, result, "inodeids", inodePks);
  } else {
    aboutToAccessStorage(qfinder, inodePks);
    result = dataAccess.findAttributesByPkList(inodePks);
    gotFromDB(result);
    miss(qfinder, result, "inodeids", inodePks);
    if(result!=null){
      for(INodeAttributes iNodeAttributes:result){
        log("read-attributes", "id", iNodeAttributes.getInodeId(), "DSQ", iNodeAttributes.getDsQuota(),"DS", iNodeAttributes.getDiskspace(), "NSQ", iNodeAttributes.getNsQuota(), "NS", iNodeAttributes.getNsCount());
      }

    }
  }
  return result;
}
项目:hops    文件:INodeAttributesContext.java   
private void updateAttributes(INodeCandidatePrimaryKey trg_param,
    List<INodeCandidatePrimaryKey> toBeDeletedSrcs)
    throws TransactionContextException {
  toBeDeletedSrcs.remove(trg_param);
  for (INodeCandidatePrimaryKey src : toBeDeletedSrcs) {
    if (contains(src.getInodeId())) {
      INodeAttributes toBeDeleted = get(src.getInodeId());
      INodeAttributes toBeAdded = clone(toBeDeleted, trg_param.getInodeId());

      remove(toBeDeleted);
      if(isLogDebugEnabled()) {
        log("snapshot-maintenance-removed-inode-attribute", "inodeId",
                toBeDeleted.getInodeId());
      }

      add(toBeAdded);
      if(isLogDebugEnabled()) {
        log("snapshot-maintenance-added-inode-attribute", "inodeId",
                toBeAdded.getInodeId());
      }
    }
  }
}
项目:hadoop-TCP    文件:SnapshotFSImageFormat.java   
/**
 * Save SnapshotDiff list for an INodeDirectoryWithSnapshot.
 * @param sNode The directory that the SnapshotDiff list belongs to.
 * @param out The {@link DataOutput} to write.
 */
private static <N extends INode, A extends INodeAttributes, D extends AbstractINodeDiff<N, A, D>>
    void saveINodeDiffs(final AbstractINodeDiffList<N, A, D> diffs,
    final DataOutput out, ReferenceMap referenceMap) throws IOException {
  // Record the diffs in reversed order, so that we can find the correct
  // reference for INodes in the created list when loading the FSImage
  if (diffs == null) {
    out.writeInt(-1); // no diffs
  } else {
    final List<D> list = diffs.asList();
    final int size = list.size();
    out.writeInt(size);
    for (int i = size - 1; i >= 0; i--) {
      list.get(i).write(out, referenceMap);
    }
  }
}
项目:hardfs    文件:SnapshotFSImageFormat.java   
/**
 * Save SnapshotDiff list for an INodeDirectoryWithSnapshot.
 * @param sNode The directory that the SnapshotDiff list belongs to.
 * @param out The {@link DataOutput} to write.
 */
private static <N extends INode, A extends INodeAttributes, D extends AbstractINodeDiff<N, A, D>>
    void saveINodeDiffs(final AbstractINodeDiffList<N, A, D> diffs,
    final DataOutput out, ReferenceMap referenceMap) throws IOException {
  // Record the diffs in reversed order, so that we can find the correct
  // reference for INodes in the created list when loading the FSImage
  if (diffs == null) {
    out.writeInt(-1); // no diffs
  } else {
    final List<D> list = diffs.asList();
    final int size = list.size();
    out.writeInt(size);
    for (int i = size - 1; i >= 0; i--) {
      list.get(i).write(out, referenceMap);
    }
  }
}
项目:hops    文件:INodeAttributesContext.java   
@Override
public void update(INodeAttributes iNodeAttributes)
    throws TransactionContextException {
  if (iNodeAttributes.getInodeId() != INode.NON_EXISTING_ID) {
    super.update(iNodeAttributes);
    if(isLogDebugEnabled()){
      log("updated-attributes", "id", iNodeAttributes.getInodeId(), "DSQ", iNodeAttributes.getDsQuota(),"DS", iNodeAttributes.getDiskspace(), "NSQ", iNodeAttributes.getNsQuota(), "NS", iNodeAttributes.getNsCount());
    }
  } else {
    if(isLogDebugEnabled()) {
      log("updated-attributes -- IGNORED as id is not set");
    }
  }
}
项目:hops    文件:INodeAttributesContext.java   
@Override
public void remove(INodeAttributes iNodeAttributes)
    throws TransactionContextException {
  super.remove(iNodeAttributes);
  if(isLogDebugEnabled()) {
    log("removed-attributes", "id", iNodeAttributes.getInodeId());
    for(int i = 0; i < Thread.currentThread().getStackTrace().length;i++){
     System.out.println(Thread.currentThread().getStackTrace()[i]) ;
    }
  }
}
项目:hops    文件:INodeAttributesContext.java   
@Override
public INodeAttributes find(FinderType<INodeAttributes> finder,
    Object... params) throws TransactionContextException, StorageException {
  INodeAttributes.Finder qfinder = (INodeAttributes.Finder) finder;
  switch (qfinder) {
    case ByINodeId:
      return findByPrimaryKey(qfinder, params);
  }
  throw new UnsupportedOperationException(UNSUPPORTED_FINDER);
}
项目:hops    文件:INodeAttributesContext.java   
@Override
public Collection<INodeAttributes> findList(
    FinderType<INodeAttributes> finder, Object... params)
    throws TransactionContextException, StorageException {
  INodeAttributes.Finder qfinder = (INodeAttributes.Finder) finder;
  switch (qfinder) {
    case ByINodeIds:
      return findByPrimaryKeys(qfinder, params);
  }
  throw new UnsupportedOperationException(UNSUPPORTED_FINDER);
}
项目:hops    文件:INodeAttributesContext.java   
@Override
public void prepare(TransactionLocks tlm)
    throws TransactionContextException, StorageException {
  Collection<INodeAttributes> modified =
      new ArrayList<>(getModified());
  modified.addAll(getAdded());
  dataAccess.prepare(modified, getRemoved());
}
项目:hops    文件:INodeAttributesContext.java   
private INodeAttributes findByPrimaryKey(INodeAttributes.Finder qfinder,
    Object[] params) throws StorageCallPreventedException, StorageException {
  final int inodeId = (Integer) params[0];
  INodeAttributes result = null;
  if (contains(inodeId)) {
    result = get(inodeId);
    hit(qfinder, result, "inodeid", inodeId);
  } else {
    aboutToAccessStorage(qfinder, params);
    result = dataAccess.findAttributesByPk(inodeId);
    gotFromDB(inodeId, result);
    miss(qfinder, result, "inodeid", inodeId, "size", size());
  }
  return result;
}
项目:hops    文件:INodeAttributesContext.java   
private Collection<INodeAttributes> get(
    List<INodeCandidatePrimaryKey> iNodeCandidatePKs) {
  Collection<INodeAttributes> iNodeAttributeses =
      new ArrayList<>(iNodeCandidatePKs.size());
  for (INodeCandidatePrimaryKey pk : iNodeCandidatePKs) {
    iNodeAttributeses.add(get(pk.getInodeId()));
  }
  return iNodeAttributeses;
}
项目:hops    文件:BaseINodeLock.java   
protected void acquireINodeAttributes()
    throws StorageException, TransactionContextException {
  List<INodeCandidatePrimaryKey> pks =
      new ArrayList<>();
  for (INode inode : getAllResolvedINodes()) {
    if (inode instanceof INodeDirectoryWithQuota) {
      INodeCandidatePrimaryKey pk =
          new INodeCandidatePrimaryKey(inode.getId());
      pks.add(pk);
    }
  }
  acquireLockList(DEFAULT_LOCK_TYPE, INodeAttributes.Finder.ByINodeIds, pks);
}
项目:hops    文件:INodeAttributesContext.java   
public INodeAttributesContext(
    INodeAttributesDataAccess<INodeAttributes> dataAccess) {
  this.dataAccess = dataAccess;
}
项目:hops    文件:INodeAttributesContext.java   
@Override
Integer getKey(INodeAttributes iNodeAttributes) {
  return iNodeAttributes.getInodeId();
}
项目:hops    文件:INodeAttributesContext.java   
private INodeAttributes clone(INodeAttributes src, int inodeId) {
  return new INodeAttributes(inodeId, src.getNsQuota(), src.getNsCount(),
      src.getDsQuota(), src.getDiskspace());
}