Java 类org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.XAttrCompactProto 实例源码

项目:hadoop    文件:FSImageFormatPBINode.java   
public static ImmutableList<XAttr> loadXAttrs(
    XAttrFeatureProto proto, final String[] stringTable) {
  ImmutableList.Builder<XAttr> b = ImmutableList.builder();
  for (XAttrCompactProto xAttrCompactProto : proto.getXAttrsList()) {
    int v = xAttrCompactProto.getName();
    int nid = (v >> XATTR_NAME_OFFSET) & XATTR_NAME_MASK;
    int ns = (v >> XATTR_NAMESPACE_OFFSET) & XATTR_NAMESPACE_MASK;
    ns |=
        ((v >> XATTR_NAMESPACE_EXT_OFFSET) & XATTR_NAMESPACE_EXT_MASK) << 2;
    String name = stringTable[nid];
    byte[] value = null;
    if (xAttrCompactProto.getValue() != null) {
      value = xAttrCompactProto.getValue().toByteArray();
    }
    b.add(new XAttr.Builder().setNameSpace(XATTR_NAMESPACE_VALUES[ns])
        .setName(name).setValue(value).build());
  }

  return b.build();
}
项目:hadoop    文件:FSImageFormatPBINode.java   
private static XAttrFeatureProto.Builder buildXAttrs(XAttrFeature f,
    final SaverContext.DeduplicationMap<String> stringMap) {
  XAttrFeatureProto.Builder b = XAttrFeatureProto.newBuilder();
  for (XAttr a : f.getXAttrs()) {
    XAttrCompactProto.Builder xAttrCompactBuilder = XAttrCompactProto.
        newBuilder();
    int nsOrd = a.getNameSpace().ordinal();
    Preconditions.checkArgument(nsOrd < 8, "Too many namespaces.");
    int v = ((nsOrd & XATTR_NAMESPACE_MASK) << XATTR_NAMESPACE_OFFSET)
        | ((stringMap.getId(a.getName()) & XATTR_NAME_MASK) <<
            XATTR_NAME_OFFSET);
    v |= (((nsOrd >> 2) & XATTR_NAMESPACE_EXT_MASK) <<
        XATTR_NAMESPACE_EXT_OFFSET);
    xAttrCompactBuilder.setName(v);
    if (a.getValue() != null) {
      xAttrCompactBuilder.setValue(PBHelper.getByteString(a.getValue()));
    }
    b.addXAttrs(xAttrCompactBuilder.build());
  }

  return b;
}
项目:aliyun-oss-hadoop-fs    文件:FSImageFormatPBINode.java   
public static List<XAttr> loadXAttrs(
    XAttrFeatureProto proto, final String[] stringTable) {
  List<XAttr> b = new ArrayList<>();
  for (XAttrCompactProto xAttrCompactProto : proto.getXAttrsList()) {
    int v = xAttrCompactProto.getName();
    int nid = (v >> XATTR_NAME_OFFSET) & XATTR_NAME_MASK;
    int ns = (v >> XATTR_NAMESPACE_OFFSET) & XATTR_NAMESPACE_MASK;
    ns |=
        ((v >> XATTR_NAMESPACE_EXT_OFFSET) & XATTR_NAMESPACE_EXT_MASK) << 2;
    String name = stringTable[nid];
    byte[] value = null;
    if (xAttrCompactProto.getValue() != null) {
      value = xAttrCompactProto.getValue().toByteArray();
    }
    b.add(new XAttr.Builder().setNameSpace(XATTR_NAMESPACE_VALUES[ns])
        .setName(name).setValue(value).build());
  }

  return b;
}
项目:aliyun-oss-hadoop-fs    文件:FSImageFormatPBINode.java   
private static XAttrFeatureProto.Builder buildXAttrs(XAttrFeature f,
    final SaverContext.DeduplicationMap<String> stringMap) {
  XAttrFeatureProto.Builder b = XAttrFeatureProto.newBuilder();
  for (XAttr a : f.getXAttrs()) {
    XAttrCompactProto.Builder xAttrCompactBuilder = XAttrCompactProto.
        newBuilder();
    int nsOrd = a.getNameSpace().ordinal();
    Preconditions.checkArgument(nsOrd < 8, "Too many namespaces.");
    int v = ((nsOrd & XATTR_NAMESPACE_MASK) << XATTR_NAMESPACE_OFFSET)
        | ((stringMap.getId(a.getName()) & XATTR_NAME_MASK) <<
            XATTR_NAME_OFFSET);
    v |= (((nsOrd >> 2) & XATTR_NAMESPACE_EXT_MASK) <<
        XATTR_NAMESPACE_EXT_OFFSET);
    xAttrCompactBuilder.setName(v);
    if (a.getValue() != null) {
      xAttrCompactBuilder.setValue(PBHelperClient.getByteString(a.getValue()));
    }
    b.addXAttrs(xAttrCompactBuilder.build());
  }

  return b;
}
项目:big-c    文件:FSImageFormatPBINode.java   
public static ImmutableList<XAttr> loadXAttrs(
    XAttrFeatureProto proto, final String[] stringTable) {
  ImmutableList.Builder<XAttr> b = ImmutableList.builder();
  for (XAttrCompactProto xAttrCompactProto : proto.getXAttrsList()) {
    int v = xAttrCompactProto.getName();
    int nid = (v >> XATTR_NAME_OFFSET) & XATTR_NAME_MASK;
    int ns = (v >> XATTR_NAMESPACE_OFFSET) & XATTR_NAMESPACE_MASK;
    ns |=
        ((v >> XATTR_NAMESPACE_EXT_OFFSET) & XATTR_NAMESPACE_EXT_MASK) << 2;
    String name = stringTable[nid];
    byte[] value = null;
    if (xAttrCompactProto.getValue() != null) {
      value = xAttrCompactProto.getValue().toByteArray();
    }
    b.add(new XAttr.Builder().setNameSpace(XATTR_NAMESPACE_VALUES[ns])
        .setName(name).setValue(value).build());
  }

  return b.build();
}
项目:big-c    文件:FSImageFormatPBINode.java   
private static XAttrFeatureProto.Builder buildXAttrs(XAttrFeature f,
    final SaverContext.DeduplicationMap<String> stringMap) {
  XAttrFeatureProto.Builder b = XAttrFeatureProto.newBuilder();
  for (XAttr a : f.getXAttrs()) {
    XAttrCompactProto.Builder xAttrCompactBuilder = XAttrCompactProto.
        newBuilder();
    int nsOrd = a.getNameSpace().ordinal();
    Preconditions.checkArgument(nsOrd < 8, "Too many namespaces.");
    int v = ((nsOrd & XATTR_NAMESPACE_MASK) << XATTR_NAMESPACE_OFFSET)
        | ((stringMap.getId(a.getName()) & XATTR_NAME_MASK) <<
            XATTR_NAME_OFFSET);
    v |= (((nsOrd >> 2) & XATTR_NAMESPACE_EXT_MASK) <<
        XATTR_NAMESPACE_EXT_OFFSET);
    xAttrCompactBuilder.setName(v);
    if (a.getValue() != null) {
      xAttrCompactBuilder.setValue(PBHelper.getByteString(a.getValue()));
    }
    b.addXAttrs(xAttrCompactBuilder.build());
  }

  return b;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:FSImageFormatPBINode.java   
public static ImmutableList<XAttr> loadXAttrs(
    XAttrFeatureProto proto, final String[] stringTable) {
  ImmutableList.Builder<XAttr> b = ImmutableList.builder();
  for (XAttrCompactProto xAttrCompactProto : proto.getXAttrsList()) {
    int v = xAttrCompactProto.getName();
    int nid = (v >> XATTR_NAME_OFFSET) & XATTR_NAME_MASK;
    int ns = (v >> XATTR_NAMESPACE_OFFSET) & XATTR_NAMESPACE_MASK;
    ns |=
        ((v >> XATTR_NAMESPACE_EXT_OFFSET) & XATTR_NAMESPACE_EXT_MASK) << 2;
    String name = stringTable[nid];
    byte[] value = null;
    if (xAttrCompactProto.getValue() != null) {
      value = xAttrCompactProto.getValue().toByteArray();
    }
    b.add(new XAttr.Builder().setNameSpace(XATTR_NAMESPACE_VALUES[ns])
        .setName(name).setValue(value).build());
  }

  return b.build();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:FSImageFormatPBINode.java   
private static XAttrFeatureProto.Builder buildXAttrs(XAttrFeature f,
    final SaverContext.DeduplicationMap<String> stringMap) {
  XAttrFeatureProto.Builder b = XAttrFeatureProto.newBuilder();
  for (XAttr a : f.getXAttrs()) {
    XAttrCompactProto.Builder xAttrCompactBuilder = XAttrCompactProto.
        newBuilder();
    int nsOrd = a.getNameSpace().ordinal();
    Preconditions.checkArgument(nsOrd < 8, "Too many namespaces.");
    int v = ((nsOrd & XATTR_NAMESPACE_MASK) << XATTR_NAMESPACE_OFFSET)
        | ((stringMap.getId(a.getName()) & XATTR_NAME_MASK) <<
            XATTR_NAME_OFFSET);
    v |= (((nsOrd >> 2) & XATTR_NAMESPACE_EXT_MASK) <<
        XATTR_NAMESPACE_EXT_OFFSET);
    xAttrCompactBuilder.setName(v);
    if (a.getValue() != null) {
      xAttrCompactBuilder.setValue(PBHelper.getByteString(a.getValue()));
    }
    b.addXAttrs(xAttrCompactBuilder.build());
  }

  return b;
}
项目:FlexMap    文件:FSImageFormatPBINode.java   
public static ImmutableList<XAttr> loadXAttrs(
    XAttrFeatureProto proto, final String[] stringTable) {
  ImmutableList.Builder<XAttr> b = ImmutableList.builder();
  for (XAttrCompactProto xAttrCompactProto : proto.getXAttrsList()) {
    int v = xAttrCompactProto.getName();
    int nid = (v >> XATTR_NAME_OFFSET) & XATTR_NAME_MASK;
    int ns = (v >> XATTR_NAMESPACE_OFFSET) & XATTR_NAMESPACE_MASK;
    ns |=
        ((v >> XATTR_NAMESPACE_EXT_OFFSET) & XATTR_NAMESPACE_EXT_MASK) << 2;
    String name = stringTable[nid];
    byte[] value = null;
    if (xAttrCompactProto.getValue() != null) {
      value = xAttrCompactProto.getValue().toByteArray();
    }
    b.add(new XAttr.Builder().setNameSpace(XATTR_NAMESPACE_VALUES[ns])
        .setName(name).setValue(value).build());
  }

  return b.build();
}
项目:FlexMap    文件:FSImageFormatPBINode.java   
private static XAttrFeatureProto.Builder buildXAttrs(XAttrFeature f,
    final SaverContext.DeduplicationMap<String> stringMap) {
  XAttrFeatureProto.Builder b = XAttrFeatureProto.newBuilder();
  for (XAttr a : f.getXAttrs()) {
    XAttrCompactProto.Builder xAttrCompactBuilder = XAttrCompactProto.
        newBuilder();
    int nsOrd = a.getNameSpace().ordinal();
    Preconditions.checkArgument(nsOrd < 8, "Too many namespaces.");
    int v = ((nsOrd & XATTR_NAMESPACE_MASK) << XATTR_NAMESPACE_OFFSET)
        | ((stringMap.getId(a.getName()) & XATTR_NAME_MASK) <<
            XATTR_NAME_OFFSET);
    v |= (((nsOrd >> 2) & XATTR_NAMESPACE_EXT_MASK) <<
        XATTR_NAMESPACE_EXT_OFFSET);
    xAttrCompactBuilder.setName(v);
    if (a.getValue() != null) {
      xAttrCompactBuilder.setValue(PBHelper.getByteString(a.getValue()));
    }
    b.addXAttrs(xAttrCompactBuilder.build());
  }

  return b;
}