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

项目:hadoop-2.6.0-cdh5.4.3    文件:FSImageFormatPBINode.java   
public static INodeDirectory loadINodeDirectory(INodeSection.INode n,
    LoaderContext state) {
  assert n.getType() == INodeSection.INode.Type.DIRECTORY;
  INodeSection.INodeDirectory d = n.getDirectory();

  final PermissionStatus permissions = loadPermission(d.getPermission(),
      state.getStringTable());
  final INodeDirectory dir = new INodeDirectory(n.getId(), n.getName()
      .toByteArray(), permissions, d.getModificationTime());

  final long nsQuota = d.getNsQuota(), dsQuota = d.getDsQuota();
  if (nsQuota >= 0 || dsQuota >= 0) {
    dir.addDirectoryWithQuotaFeature(nsQuota, dsQuota);
  }

  if (d.hasAcl()) {
    dir.addAclFeature(new AclFeature(loadAclEntries(d.getAcl(),
        state.getStringTable())));
  }
  if (d.hasXAttrs()) {
    dir.addXAttrFeature(new XAttrFeature(
        loadXAttrs(d.getXAttrs(), state.getStringTable())));
  }
  return dir;
}
项目:FlexMap    文件:FSImageFormatPBINode.java   
public static INodeDirectory loadINodeDirectory(INodeSection.INode n,
    LoaderContext state) {
  assert n.getType() == INodeSection.INode.Type.DIRECTORY;
  INodeSection.INodeDirectory d = n.getDirectory();

  final PermissionStatus permissions = loadPermission(d.getPermission(),
      state.getStringTable());
  final INodeDirectory dir = new INodeDirectory(n.getId(), n.getName()
      .toByteArray(), permissions, d.getModificationTime());

  final long nsQuota = d.getNsQuota(), dsQuota = d.getDsQuota();
  if (nsQuota >= 0 || dsQuota >= 0) {
    dir.addDirectoryWithQuotaFeature(nsQuota, dsQuota);
  }

  if (d.hasAcl()) {
    dir.addAclFeature(new AclFeature(loadAclEntries(d.getAcl(),
        state.getStringTable())));
  }
  if (d.hasXAttrs()) {
    dir.addXAttrFeature(new XAttrFeature(
        loadXAttrs(d.getXAttrs(), state.getStringTable())));
  }
  return dir;
}
项目:hadoop-on-lustre2    文件:FSImageFormatPBINode.java   
public static INodeDirectory loadINodeDirectory(INodeSection.INode n,
    LoaderContext state) {
  assert n.getType() == INodeSection.INode.Type.DIRECTORY;
  INodeSection.INodeDirectory d = n.getDirectory();

  final PermissionStatus permissions = loadPermission(d.getPermission(),
      state.getStringTable());
  final INodeDirectory dir = new INodeDirectory(n.getId(), n.getName()
      .toByteArray(), permissions, d.getModificationTime());

  final long nsQuota = d.getNsQuota(), dsQuota = d.getDsQuota();
  if (nsQuota >= 0 || dsQuota >= 0) {
    dir.addDirectoryWithQuotaFeature(nsQuota, dsQuota);
  }

  if (d.hasAcl()) {
    dir.addAclFeature(new AclFeature(loadAclEntries(d.getAcl(),
        state.getStringTable())));
  }
  return dir;
}
项目:hadoop    文件:FSImageFormatPBINode.java   
public static INodeDirectory loadINodeDirectory(INodeSection.INode n,
    LoaderContext state) {
  assert n.getType() == INodeSection.INode.Type.DIRECTORY;
  INodeSection.INodeDirectory d = n.getDirectory();

  final PermissionStatus permissions = loadPermission(d.getPermission(),
      state.getStringTable());
  final INodeDirectory dir = new INodeDirectory(n.getId(), n.getName()
      .toByteArray(), permissions, d.getModificationTime());
  final long nsQuota = d.getNsQuota(), dsQuota = d.getDsQuota();
  if (nsQuota >= 0 || dsQuota >= 0) {
    dir.addDirectoryWithQuotaFeature(new DirectoryWithQuotaFeature.Builder().
        nameSpaceQuota(nsQuota).storageSpaceQuota(dsQuota).build());
  }
  EnumCounters<StorageType> typeQuotas = null;
  if (d.hasTypeQuotas()) {
    ImmutableList<QuotaByStorageTypeEntry> qes =
        loadQuotaByStorageTypeEntries(d.getTypeQuotas());
    typeQuotas = new EnumCounters<StorageType>(StorageType.class,
        HdfsConstants.QUOTA_RESET);
    for (QuotaByStorageTypeEntry qe : qes) {
      if (qe.getQuota() >= 0 && qe.getStorageType() != null &&
          qe.getStorageType().supportTypeQuota()) {
        typeQuotas.set(qe.getStorageType(), qe.getQuota());
      }
    }

    if (typeQuotas.anyGreaterOrEqual(0)) {
      DirectoryWithQuotaFeature q = dir.getDirectoryWithQuotaFeature();
      if (q == null) {
        dir.addDirectoryWithQuotaFeature(new DirectoryWithQuotaFeature.
            Builder().typeQuotas(typeQuotas).build());
      } else {
        q.setQuota(typeQuotas);
      }
    }
  }

  if (d.hasAcl()) {
    int[] entries = AclEntryStatusFormat.toInt(loadAclEntries(
        d.getAcl(), state.getStringTable()));
    dir.addAclFeature(new AclFeature(entries));
  }
  if (d.hasXAttrs()) {
    dir.addXAttrFeature(new XAttrFeature(
        loadXAttrs(d.getXAttrs(), state.getStringTable())));
  }
  return dir;
}
项目:aliyun-oss-hadoop-fs    文件:FSImageFormatPBINode.java   
public static INodeDirectory loadINodeDirectory(INodeSection.INode n,
    LoaderContext state) {
  assert n.getType() == INodeSection.INode.Type.DIRECTORY;
  INodeSection.INodeDirectory d = n.getDirectory();

  final PermissionStatus permissions = loadPermission(d.getPermission(),
      state.getStringTable());
  final INodeDirectory dir = new INodeDirectory(n.getId(), n.getName()
      .toByteArray(), permissions, d.getModificationTime());
  final long nsQuota = d.getNsQuota(), dsQuota = d.getDsQuota();
  if (nsQuota >= 0 || dsQuota >= 0) {
    dir.addDirectoryWithQuotaFeature(new DirectoryWithQuotaFeature.Builder().
        nameSpaceQuota(nsQuota).storageSpaceQuota(dsQuota).build());
  }
  EnumCounters<StorageType> typeQuotas = null;
  if (d.hasTypeQuotas()) {
    ImmutableList<QuotaByStorageTypeEntry> qes =
        loadQuotaByStorageTypeEntries(d.getTypeQuotas());
    typeQuotas = new EnumCounters<StorageType>(StorageType.class,
        HdfsConstants.QUOTA_RESET);
    for (QuotaByStorageTypeEntry qe : qes) {
      if (qe.getQuota() >= 0 && qe.getStorageType() != null &&
          qe.getStorageType().supportTypeQuota()) {
        typeQuotas.set(qe.getStorageType(), qe.getQuota());
      }
    }

    if (typeQuotas.anyGreaterOrEqual(0)) {
      DirectoryWithQuotaFeature q = dir.getDirectoryWithQuotaFeature();
      if (q == null) {
        dir.addDirectoryWithQuotaFeature(new DirectoryWithQuotaFeature.
            Builder().typeQuotas(typeQuotas).build());
      } else {
        q.setQuota(typeQuotas);
      }
    }
  }

  if (d.hasAcl()) {
    int[] entries = AclEntryStatusFormat.toInt(loadAclEntries(
        d.getAcl(), state.getStringTable()));
    dir.addAclFeature(new AclFeature(entries));
  }
  if (d.hasXAttrs()) {
    dir.addXAttrFeature(new XAttrFeature(
        loadXAttrs(d.getXAttrs(), state.getStringTable())));
  }
  return dir;
}
项目:big-c    文件:FSImageFormatPBINode.java   
public static INodeDirectory loadINodeDirectory(INodeSection.INode n,
    LoaderContext state) {
  assert n.getType() == INodeSection.INode.Type.DIRECTORY;
  INodeSection.INodeDirectory d = n.getDirectory();

  final PermissionStatus permissions = loadPermission(d.getPermission(),
      state.getStringTable());
  final INodeDirectory dir = new INodeDirectory(n.getId(), n.getName()
      .toByteArray(), permissions, d.getModificationTime());
  final long nsQuota = d.getNsQuota(), dsQuota = d.getDsQuota();
  if (nsQuota >= 0 || dsQuota >= 0) {
    dir.addDirectoryWithQuotaFeature(new DirectoryWithQuotaFeature.Builder().
        nameSpaceQuota(nsQuota).storageSpaceQuota(dsQuota).build());
  }
  EnumCounters<StorageType> typeQuotas = null;
  if (d.hasTypeQuotas()) {
    ImmutableList<QuotaByStorageTypeEntry> qes =
        loadQuotaByStorageTypeEntries(d.getTypeQuotas());
    typeQuotas = new EnumCounters<StorageType>(StorageType.class,
        HdfsConstants.QUOTA_RESET);
    for (QuotaByStorageTypeEntry qe : qes) {
      if (qe.getQuota() >= 0 && qe.getStorageType() != null &&
          qe.getStorageType().supportTypeQuota()) {
        typeQuotas.set(qe.getStorageType(), qe.getQuota());
      }
    }

    if (typeQuotas.anyGreaterOrEqual(0)) {
      DirectoryWithQuotaFeature q = dir.getDirectoryWithQuotaFeature();
      if (q == null) {
        dir.addDirectoryWithQuotaFeature(new DirectoryWithQuotaFeature.
            Builder().typeQuotas(typeQuotas).build());
      } else {
        q.setQuota(typeQuotas);
      }
    }
  }

  if (d.hasAcl()) {
    int[] entries = AclEntryStatusFormat.toInt(loadAclEntries(
        d.getAcl(), state.getStringTable()));
    dir.addAclFeature(new AclFeature(entries));
  }
  if (d.hasXAttrs()) {
    dir.addXAttrFeature(new XAttrFeature(
        loadXAttrs(d.getXAttrs(), state.getStringTable())));
  }
  return dir;
}